SDK
SDK Jvm v1.x
2

get #

Gets a document.


:::: tabs ::: tab Java

Arguments #

public CompletableFuture<Map<String, Object>> get(
      String index,
      String collection,
      String id)
throws NotConnectedException, InternalException
ArgumentsTypeDescription
index
String
Index
collection
String
Collection
id
String
Document ID

Return #

A Map which has the following properties:

PropertyTypeDescription
_source
Map
Document content
_id
String
ID of the document
_version
Integer
Version of the document in the persistent data storage

Usage #

  Map<String, Object> result =
  kuzzle.getDocumentController().get("nyc-open-data", "yellow-taxi", "some-id")
  .get();
/*
  {
    _source=
      {
        key1=value1,
        key2=value2,
        _kuzzle_info= { createdAt=1582892127577, author=-1}
      },
    _id=some-id,
    _version=1
  }
*/

::: ::: tab Kotlin

Arguments #

fun get(
      index: String,
      collection: String,
      id: String): CompletableFuture<Map<String, Any?>>
ArgumentsTypeDescription
index
String
Index
collection
String
Collection
id
String
Document ID

Return #

A Map which has the following properties:

PropertyTypeDescription
_source
Map
Document content
_id
String
ID of the document
_version
Integer
Version of the document in the persistent data storage

Usage #

val result: Map<String, Any?> =
  kuzzle
    .documentController
    .get("nyc-open-data", "yellow-taxi", "some-id")
    .get()

::: ::::