SDK
SDK Jvm v1.x
2

get #

Gets a document.


:::: tabs ::: tab Java

Arguments #

Copied to clipboard!
public CompletableFuture<Map<String, Object>> get(
      String index,
      String collection,
      String id)
throws NotConnectedException, InternalException

Arguments Type Description
index
String
Index
collection
String
Collection
id
String
Document ID

Return #

A Map which has the following properties:

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

Usage #

Copied to clipboard!
  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 #

Copied to clipboard!
fun get(
      index: String,
      collection: String,
      id: String): CompletableFuture<Map<String, Any?>>

Arguments Type Description
index
String
Index
collection
String
Collection
id
String
Document ID

Return #

A Map which has the following properties:

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

Usage #

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

::: ::::