Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Latest commit

 

History

History
70 lines (52 loc) · 3.32 KB

File metadata and controls

70 lines (52 loc) · 3.32 KB
code type title description
true
page
mCreateOrReplace
Creates or replaces multiple documents

mCreateOrReplace

Creates or replaces multiple documents.


Arguments

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

documents

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

Return

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

Usage

<<< ./snippets/m-create-or-replace.java