Elasticsearch Fielddata

Get an Elasticsearch Check-Up

Check if your ES issues are caused from misconfigured settings

2-min process

Perform an Elasticsearch Check Up (2 min process) 

Fielddata in Elasticsearch

What it is 

In Elasticsearch the term Fielddata is relevant when doing Sorting and Aggregations ( similar to SQL GROUP BY COUNT and AVERAGE functions ) on text fields.  

For performance reasons, there are some rules as to which kinds of fields you can aggregate. You can group by any numeric field but for text fields, which have to be of keyword type or have fielddata=true since they dont support doc_values ( Doc values are the on-disk inverted index data structure, built at document indexing time, which makes aggregations possible). 

Fielddata is an in-memory data structure used by text fields for the same purpose. Since it uses a lot of heap size it is disabled by default.

Examples:

The following PUT mapping API call will enable Fielddata on my_field text field.

PUT my_index/_mapping{  "properties": {    "my_field": {       "type":     "text",      "fielddata": true    }  }}
Notes:
  • As field-data is disabled by default on text fields, in case of an attempt  to aggregate on a text field with field-data disabled, you would get the following error message:
    “Fielddata is disabled on text fields by default.  Set `fielddata=true` on [`your_field_name`] in order to load field data in memory by uninverting the inverted index. Note that this can however, use “significant memory.” – if this happens you can either enable the field-data on that text field, or choose another way to query the data (again, because field-data consumes a lot of memory and is not recommended).

About Opster

Incorporating deep knowledge and broad history of Elasticsearch issues. Opster solution identifies and predicts root causes of Elasticsearch problems, provides recommendations and can automatically perform various actions to manage, troubleshoot and prevent issues

Learn more: Glossary | Blog| Troubleshooting guides

Need help with any Elasticsearch issue ? Contact Opster

Did this page help you?

Check your Elasticsearch Settings  


Click below to learn how to fix common problems related to these concepts
« Back to Index