mGet #
Gets multiple documents.
Query Syntax #
HTTP #
URL: http://kuzzle:7512/<index>/<collection>/_mGet[?includeTrash=<true|false>]
Method: POST
Body:
{
"ids": ["<documentId>", "<anotherDocumentId>"]
}
Other protocols #
{
"index": "<index>",
"collection": "<collection>",
"controller": "document",
"action": "mGet",
"body": {
"ids": ["<documentId>", "<anotherDocumentId>"]
},
"includeTrash": false
}
Arguments #
collection
: collection nameindex
: 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 documentfound
: 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.
{
"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
}
}
Edit this page on Github(opens new window)