WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Fields Usage
editFields Usage
editAllows to selectively load specific stored fields for each document represented by a search hit.
The fields
parameter is about fields that are explicitly marked as stored in the mapping,
which is off by default and generally not recommended.
Use source filtering instead to select subsets of the original source document to be returned.
See the Elasticsearch documentation on Fields for more detail.
Fluent DSL example
edits => s .Fields(fs => fs .Field(p => p.Name) .Field(p => p.StartedOn) .Field(p => p.DateString) )
Object Initializer syntax example
editnew SearchRequest<Project> { Fields = Fields<Project>(p => p.Name, p => p.StartedOn, p => p.DateString) }
Example json output.
{ "fields": [ "name", "startedOn", "dateString" ] }