SDK
SDK Java v3.x
2

# mGet

Gets multiple documents.


# Arguments

Copied to clipboard!
public CompletableFuture<ConcurrentHashMap<String, ArrayList<Object>>> mGet(
      final String index,
      final String collection,
      final ArrayList<String> ids)
throws NotConnectedException, InternalException

Arguments Type Description
index
String
Index name
collection
String
Collection name
ids ArrayList<String> Document IDs

# 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>
Document content
_id
String
Document ID
_version
Integer
Version of the document in the persistent data storage

The errors array contain the IDs of not found documents.

# Usage

Copied to clipboard!
  final ArrayList<String> ids = new ArrayList<>();
  ids.add("some-id");
  ids.add("some-id2");
  ConcurrentHashMap<String, ArrayList<Object>> result = kuzzle.getDocumentController().mGet("nyc-open-data", "yellow-taxi", ids)
  .get();
/*
  result =
    {
      successes=
      [
        {
          result=created,
          _source=
            {
              key=value,
              _kuzzle_info={createdAt=1582892842099, author=-1}
            },
          _id=some-id,
          _version=1
        },
        {
          result=created,
          _source=
            {
              key=value,
              _kuzzle_info={createdAt=1582892842099, author=-1}
            },
          _id=some-id2,
          _version=1
        }
      ],
      errors=[]
    }
*/