SDK
SDK Java v3.x
2

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

mGet #

Gets multiple documents.


Arguments #

public CompletableFuture<ConcurrentHashMap<String, ArrayList<Object>>> mGet(
      final String index,
      final String collection,
      final ArrayList<String> ids)
throws NotConnectedException, InternalException
ArgumentsTypeDescription
index
String
Index name
collection
String
Collection name
idsArrayList<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:

PropertyTypeDescription
_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 #

  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=[]
    }
*/