| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 | [[search-request-stored-fields]]=== FieldsWARNING: The `stored_fields` parameter is about fields that are explicitly marked asstored in the mapping, which is off by default and generally not recommended.Use <<search-request-source-filtering,source filtering>> instead to selectsubsets of the original source document to be returned.Allows to selectively load specific stored fields for each document representedby a search hit.[source,js]--------------------------------------------------GET /_search{    "stored_fields" : ["user", "postDate"],    "query" : {        "term" : { "user" : "kimchy" }    }}--------------------------------------------------// CONSOLE`*` can be used to load all stored fields from the document.An empty array will cause only the `_id` and `_type` for each hit to bereturned, for example:[source,js]--------------------------------------------------GET /_search{    "stored_fields" : [],    "query" : {        "term" : { "user" : "kimchy" }    }}--------------------------------------------------// CONSOLEIf the requested fields are not stored (`store` mapping set to `false`), they will be ignored.Stored field values fetched from the document itself are always returned as an array. On the contrary, metadata fields like `_routing` are never returned as an array.Also only leaf fields can be returned via the `field` option. So object fields can't be returned and such requestswill fail.Script fields can also be automatically detected and used as fields, sothings like `_source.obj1.field1` can be used, though not recommended, as`obj1.field1` will work as well.==== Disable stored fields entirelyTo disable the stored fields (and metadata fields) entirely use: `_none_`:[source,js]--------------------------------------------------GET /_search{    "stored_fields": "_none_",    "query" : {        "term" : { "user" : "kimchy" }    }}--------------------------------------------------// CONSOLENOTE: <<search-request-source-filtering,`_source`>> and <<search-request-version, `version`>> parameters cannot be activated if `_none_` is used.
 |