Allows to return the doc value representation of a field for each hit, for example:
the name of the field
date fields may use a custom format
Doc value fields can work on fields that are not stored.
Note that if the fields parameter specifies fields without docvalues it will try to load the value from the fielddata cache causing the terms for that field to be loaded to memory (cached), which will result in more memory consumption.
While most fields do not support custom formats, some of them do:
All fields support the special
use_field_mapping format, which tells
Elasticsearch to use the mappings to figure out a default format.
The default is currently to return the same output as
script fields. However it will change in 7.0
to behave as if the
use_field_mapping format was provided.