illegal_argument_exception_fielddata: illegal_argument_exception: Fielddata is disabled on text fields by default. Set fielddata=true on [your_field] in order to load fielddata in memory
ElasticsearchWhat does it mean?
An aggregation, sort or script was attempted on an analyzed text field. These operations are disabled by default on text fields because they require memory-expensive fielddata.
Why does it happen?
An aggregation/sort was applied directly to a text field. In Elasticsearch, text is used for full-text search and keyword for exact-value aggregation/sorting; mixing the two produces this error.
How to fix it
Use the field's keyword sub-field for aggregation/sorting (e.g. "my_field.keyword"). If the field is text only, add a keyword sub-field to the mapping (multi-field) and run _reindex. Enabling fielddata on a text field (fielddata=true) is possible but not recommended due to high memory consumption and circuit breaker risk; use it only when unavoidable.
More from this engine
- circuit_breaking_exceptionCircuitBreakingException[[parent] Data too large, data for [<...>] would be [...], which is larger than the limit of [...]]
- mapper_parsing_exceptionmapper_parsing_exception: failed to parse field [...] of type [...]
- strict_dynamic_mapping_exceptionstrict_dynamic_mapping_exception: mapping set to strict, dynamic introduction of [...] within [...] is not allowed
- search_phase_execution_exceptionsearch_phase_execution_exception: all shards failed / Failed to execute phase [query]
- too_many_clausestoo_many_clauses: maxClauseCount is set to 1024 (query contains too many clauses)
- version_conflict_engine_exceptionversion_conflict_engine_exception: [_doc][id]: version conflict, current version [x] is different than the one provided [y] (HTTP 409)
- document_missing_exceptiondocument_missing_exception: [_doc][id]: document missing