Elasticsearch Fielddata

Opster Team

Last updated: Mar 8, 2023

| 1 min read

In addition to reading this guide, we recommend you run the Elasticsearch Health Check-Up. It will detect issues and improve your Elasticsearch performance by analyzing your shard sizes, threadpools, memory, snapshots, disk watermarks and more.

The Elasticsearch Check-Up is free and requires no installation.

Before you begin reading this guide, we recommend you try running the Elasticsearch Error Check-Up which analyzes 2 JSON files to detect many configuration errors.

To evaluate your use of Elasticsearch Fielddata and automatically fix issues related to this concept, we recommend you try the AutoOps platform. It will also prevent & resolve other Elasticsearch issues, cut down administration time and reduce hardware costs. Try it for free.

Overview

In Elasticsearch the term fielddata is relevant when sorting and doing aggregations (similar to SQL GROUP BY COUNT and AVERAGE functions) on text fields.  

For performance reasons, there are some rules as to the kinds of fields that can be aggregated. You can group by any numeric field but for text fields, which have to be of keyword type or have fielddata=true since they don’t 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).

Related log errors to this ES concept


Failed to call listener on field data cache unloading
Unable to estimate memory overhead
Failed to call listener on atomic field data loading
Failed to call listener on global ordinals loading
Failed to find format
Reducing requested field data cache size of to the maximum allowed size of

Watch product tour

Try AutoOps to find & fix Elasticsearch problems

Analyze Your Cluster
Skip to content