code | type | title | description |
---|---|---|---|
true |
page |
mCreateOrReplace |
Creates or replaces multiple documents |
Creates or replaces multiple documents.
public CompletableFuture<ConcurrentHashMap<String, ArrayList<Object>>> mCreateOrReplace(
final String index,
final String collection,
final ArrayList<ConcurrentHashMap<String, Object>> documents)
throws NotConnectedException, InternalException
public CompletableFuture<ConcurrentHashMap<String, ArrayList<Object>>> mCreateOrReplace(
final String index,
final String collection,
final ArrayList<ConcurrentHashMap<String, Object>> documents,
final Boolean waitForRefresh)
throws NotConnectedException, InternalException
Arguments | Type | Description |
---|---|---|
index |
String |
Index |
collection |
String |
Collection |
documents |
ArrayList<ConcurrentHashMap<String, Object>> |
ArrayList containing the documents to create |
waitForRefresh |
Boolean |
If set to true , Kuzzle will wait for the persistence layer to finish indexing |
Each document has the following properties:
Arguments | Type | Description |
---|---|---|
_id |
String |
Optional document ID. Will be auto-generated if not defined. |
body |
ConcurrentHashMap<String, Object> |
Document body |
A ConcurrentHashMap<String, ArrayList<Object>>
which has a successes
and errors
ArrayList<Object>
:
Each created document is an object of the successes
array with the following properties:
Property | Type | Description |
---|---|---|
_source |
ConcurrentHashMap<String, Object> |
Created document |
_id |
String |
ID of the newly created document |
_version |
Integer |
Version of the document in the persistent data storage |
Each errored document is an object of the errors
array with the following properties:
Property | Type | Description |
---|---|---|
document |
ConcurrentHashMap<String, Object> |
Document that causes the error |
status |
Integer |
HTTP error status |
reason |
String |
Human readable reason |
<<< ./snippets/m-create-or-replace.java