Get a document by its ID
Retrieves the document with the specified ID from an index.
Path parameters
-
Name of the index that contains the document.
-
Unique identifier of the document.
Query parameters
-
force_synthetic_source boolean
Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index.
-
preference string
Specifies the node or shard the operation should be performed on. Random by default.
-
realtime boolean
If
true
, the request is real-time as opposed to near-real-time. -
refresh boolean
If true, Elasticsearch refreshes the affected shards to make this operation visible to search. If false, do nothing with refreshes.
-
routing string
Target the specified primary shard.
-
_source boolean | string | array[string]
True or false to return the _source field or not, or a list of fields to return.
-
_source_excludes string | array[string]
A comma-separated list of source fields to exclude in the response.
-
_source_includes string | array[string]
A comma-separated list of source fields to include in the response.
-
stored_fields string | array[string]
List of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the
_source
parameter defaults to false. -
version number
Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed.
-
version_type string
Specific version type: internal, external, external_gte.
Values are
internal
,external
,external_gte
, orforce
.
curl \
-X GET http://api.example.com/{index}/_doc/{id}
{
"_index": "string",
"fields": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"_ignored": [
"string"
],
"found": true,
"_id": "string",
"_primary_term": 42.0,
"_routing": "string",
"_seq_no": 42.0,
"_source": {},
"_version": 42.0
}