The above result includes the _index, _type, _id and _version
of the document we wish to retrieve, including the actual _source
of the document if it could be found (as indicated by the found
field in the response).

The API also allows to check for the existence of a document using
HEAD, for example:

By default, the get API is realtime, and is not affected by the refresh
rate of the index (when data will become visible for search). If a document
has been updated but is not yet refreshed, the get API will issue a refresh
call in-place to make the document visible. This will also make other documents
changed since the last refresh visible. In order to disable realtime GET,
one can set the realtime parameter to false.

By default, the get operation returns the contents of the _source field unless
you have used the stored_fields parameter or if the _source field is disabled.
You can turn off _source retrieval by using the _source parameter:

GET twitter/_doc/0?_source=false

If you only need one or two fields from the complete _source, you can use the _source_includes
& _source_excludes parameters to include or filter out that parts you need. This can be especially helpful
with large documents where partial retrieval can save on network overhead. Both parameters take a comma separated list
of fields or wildcard expressions. Example:

The get operation allows specifying a set of stored fields that will be
returned by passing the stored_fields parameter.
If the requested fields are not stored, they will be ignored.
Consider for instance the following mapping:

Controls a preference of which shard replicas to execute the get
request on. By default, the operation is randomized between the shard
replicas.

The preference can be set to:

_local

The operation will prefer to be executed on a local
allocated shard if possible.

Custom (string) value

A custom value will be used to guarantee that
the same shards will be used for the same custom value. This can help
with "jumping values" when hitting different shards in different refresh
states. A sample value can be something like the web session id, or the
user name.

The refresh parameter can be set to true in order to refresh the
relevant shard before the get operation and make it searchable. Setting
it to true should be done after careful thought and verification that
this does not cause a heavy load on the system (and slows down
indexing).

The get operation gets hashed into a specific shard id. It then gets
redirected to one of the replicas within that shard id and returns the
result. The replicas are the primary shard and its replicas within that
shard id group. This means that the more replicas we will have, the
better GET scaling we will have.

You can use the version parameter to retrieve the document only if
its current version is equal to the specified one. This behavior is the same
for all version types with the exception of version type FORCE which always
retrieves the document. Note that FORCE version type is deprecated.

Internally, Elasticsearch has marked the old document as deleted and added an
entirely new document. The old version of the document doesn’t disappear
immediately, although you won’t be able to access it. Elasticsearch cleans up
deleted documents in the background as you continue to index more data.