SDK
SDK Java v3.x
2

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

update #

Updates a document.


Arguments #

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

public CompletableFuture<ConcurrentHashMap<String, Object>> update(
      final String index,
      final String collection,
      final String id,
      final ConcurrentHashMap<String, Object> document,
      final UpdateOptions options)
throws NotConnectedException, InternalException
ArgumentsTypeDescription
index
String
Index
collection
String
Collection
id
String
Document ID
document
ConcurrentHashMap<String, Object>
Partial document content
options
UpdateOptions

(null)
Optional parameters

options #

A UpdateOptions object.

The following options can be set:

| Arguments | Type | Description | | ------------------ | -------------------------------------------- | --------------------------------- | | | waitForRefresh |

Boolean
| If set to true, Kuzzle will wait for the persistence layer to finish indexing| | retryOnConflict |
Integer
| The number of times the database layer should retry in case of version conflict | | source |
Boolean
| If true, returns the updated document inside the response |

Return #

A ConcurrentHashMap which has the following properties:

PropertyTypeDescription
_source
ConcurrentHashMap
Updated document (If source option set to true)
_id
String
ID of the updated document
_version
Integer
Version of the document in the persistent data storage

Usage #

  ConcurrentHashMap<String, Object> content = new ConcurrentHashMap<>();
  content.put("name", "Johny");
  ConcurrentHashMap<String, Object> result =
  kuzzle.getDocumentController().update("nyc-open-data", "yellow-taxi", "some-id", content)
  .get();
/*
  response =
  {
    _id=some-id,
    _version=2
  }
*/