SDK
SDK C# v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

MGetAsync #

Gets multiple documents.

Throws a partial error (error code 206) if one or more document can not be retrieved.

Arguments #

public async Task<JArray> MGetAsync(
  string index, 
  string collection, 
  JArray ids);

ArgumentTypeDescription
index
string
Index name
collection
string
Collection name
ids
JArray
Document IDs

Return #

A JArray containing the retrieved documents.

Each document has the following properties:

PropertyTypeDescription
_id
string
Document ID
_source
JObject
Document content

Exceptions #

Throws a KuzzleException if there is an error. See how to handle errors.

Usage #

try {
  JArray response = await kuzzle.Document.MGetAsync(
    "nyc-open-data",
    "yellow-taxi",
    JArray.Parse(@"[""some-id"", ""some-other-id""]"));
  Console.WriteLine(response.ToString());
  /*
    [
      {
        "_index": "nyc-open-data",
        "_type": "yellow-taxi",
        "_id": "some-id",
        "_version": 1,
        "found": true,
        "_source": {
          "capacity": 4,
          "_kuzzle_info": {
            "author": "-1",
            "createdAt": 1545411356404,
            "updatedAt": null,
            "updater": null,
            "active": true,
            "deletedAt": null
          }
        }
      },
      {
        "_index": "nyc-open-data",
        "_type": "yellow-taxi",
        "_id": "some-other-id",
        "_version": 1,
        "found": true,
        "_source": {
          "capacity": 7,
          "_kuzzle_info": {
            "author": "-1",
            "createdAt": 1545411356424,
            "updatedAt": null,
            "updater": null,
            "active": true,
            "deletedAt": null
          }
        }
      }
    ]
  */
  Console.WriteLine($"Successfully retrieved {response.Count} documents");
} catch (KuzzleException e) {
  Console.Error.WriteLine(e);
}