Skip to content

Get Document API

Edit page

The Get API allows to get a document from the index based on its ID. The following example gets a document from an index called “twitter”, with ID valued 1:

GET /twitter/tweet/1

The result of the above get operation is a 200 OK HTTP response code with the following body:

{
"user": "Kronuz",
"post_date": "2019-03-22T14:35:26",
"message": "Trying out Xapiand",
"_id": 1,
"_version": 1,
"#docid": 1,
"#shard": 1
}

The above result includes the _id and _version of the document we wish to retrieve, additionally to the actual body of the document.

If the document is not found, it will return a 404 Not Found HTTP response code.

By passing volatile query param to the request, you can ensure the operation will return the latest committed document from the primary shard.