Get a document's source

GET /{index}/_source/{id}

Returns the source of a document.

Path parameters

  • index string Required

    Name of the index that contains the document.

  • id string Required

    Unique identifier of the document.

Query parameters

  • Specifies the node or shard the operation should be performed on. Random by default.

  • realtime boolean

    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]
  • version number

    Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed.

  • Specific version type: internal, external, external_gte.

    Values are internal, external, external_gte, or force.

Responses

  • 200 application/json

    Additional properties are allowed.

GET /{index}/_source/{id}
curl \
 -X GET http://api.example.com/{index}/_source/{id}