Core
API 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.

mGet #

Gets multiple documents.


Query Syntax #

HTTP #

Copied to clipboard!
URL: http://kuzzle:7512/<index>/<collection>/_mGet[?includeTrash=<true|false>]
Method: POST
Body:
Copied to clipboard!
{
  "ids": ["<documentId>", "<anotherDocumentId>"]
}

Other protocols #

Copied to clipboard!
{
  "index": "<index>",
  "collection": "<collection>",
  "controller": "document",
  "action": "mGet",
  "body": {
    "ids": ["<documentId>", "<anotherDocumentId>"]
  },
  "includeTrash": false
}

Arguments #

  • collection: collection name
  • index: index name

Optional: #

  • includeTrash: if set, documents in the trashcan can be returned.

Body properties #

  • ids: an array of document identifiers to fetch

Response #

Returns a hits array with the list of retrieved documents.

Each document is an object with the following properties:

  • _id: document unique identifier
  • _source: document content
  • _version: version number of the document
  • found: false if the document was missing

If one or more document retrievals fail, the response status is set to 206, and the error object contain a partial error error.

You can use the found attribute on hits to identify missing documents.

Copied to clipboard!
{
  "status": 200,
  "error": null,
  "index": "<index>",
  "collection": "<collection>",
  "action": "mGet",
  "controller": "document",
  "requestId": "<unique request identifier>",
  "result": {
    "hits": [
      {
        "_id": "<documentId>",
        "_source": {
          // document content
        },
        "_version": 4,
        "found": true
      },
      {
        "_id": "<anotherDocumentId>",
        "_source": {
          // document content
        },
        "_version": 2,
        "found": true
      },
      {
        "_id": "<anotherDocumentId>",
        "found": false
      }
    ]
    "total": 2
  }
}