SDK
SDK Java v3.x
2

This SDK is deprecated. We recommend to use the Kuzzle SDK-JVM.
A migration guide is available here

replace #

Replaces the content of an existing document.


Arguments #

public CompletableFuture<ConcurrentHashMap<String, Object>> replace(
      final String index,
      final String collection,
      final String id,
      final ConcurrentHashMap<String, Object> document)
throws NotConnectedException, InternalException

public CompletableFuture<ConcurrentHashMap<String, Object>> replace(
      final String index,
      final String collection,
      final String id,
      final ConcurrentHashMap<String, Object> document,
      final Boolean waitForRefresh)
throws NotConnectedException, InternalException
ArgumentsTypeDescription
index
String
Index
collection
String
Collection
id
String
Document ID
document
ConcurrentHashMap<String, Object>
New content of the document to update
waitForRefresh
Boolean
If set to true, Kuzzle will wait for the persistence layer to finish indexing

Return #

A ConcurrentHashMap which has the following properties:

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

Usage #

ConcurrentHashMap<String, Object> document = new ConcurrentHashMap<>();
document.put("firstname", "John");
ConcurrentHashMap<String, Object> result = kuzzle.getDocumentController().replace("nyc-open-data", "yellow-taxi", "some-id", document)
.get();
/*
result =
  {
    _source=
      {
        firstname=John,
        _kuzzle_info={ createdAt=1582892606555, author=-1, updatedAt=1582892606555, updater=-1 }
      },
    _id=some-id,
    _version=2
  }
 */