Add finer control over _source
retrieval, in get
, mget
, get_source
, explain
& search
API
#3301
Labels
_source
retrieval, in get
, mget
, get_source
, explain
& search
API
#3301
At the moment all of the above API offer the
field
parameter to retrieve part of the stored documents. However, thefields
option was built to expose Lucene's stored fields and thus has some limitations when use to extract data from_source
. The most important one is potentially flatting the document structure.This feature adds a new parameter that allows directly retrieving parts of the
_source
, without conforming to the store fields structure.To maintain backward compatibility, you can still retrieve the
_source
by specifyingfields=["_source"]
but this special treatment will be removed in the future.Get API
The Get api parameters are supplied via the query string. New
_source
,_source_include
&_source_exclude
parameters are added, according to the following:A flag to control _source retrieval
or (default)
Only retrieve part of the source
or
Multi Get API
The Multi Get API allows you to control
_source
both on the query string (same syntax as theget
API) or on a per document basis.Query String defaults
or
etc.
Per document settings
Get_source API
The
get/_source
API is an API that is already dedicated for_source
retrieval. As such, it has a slightly different parameter naming:Explain API
The
explain
API also offers thefields
parameter. It is now extend with query string parameters, just like theget
API:or
and
Search API
The
search
API was added an extra_source
key in the body, with the same options as all the above:and
Also the
search
API supports accepting_source
retrieval settings as query string parameters. The format is identical to theget
API:_source
,_source_include
&_source_exclude
. In the case where the parameters are supplied both in the request body and the query string, the query string parameter override the body.The text was updated successfully, but these errors were encountered: