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(text 字段默认禁用 fielddata)
Elasticsearch含义
尝试在经过分析的 text 字段上执行聚合、排序或脚本。由于这些操作需要占用大量内存的 fielddata,text 字段上默认禁用这些操作。
原因
直接对 text 字段进行了聚合/排序。在 Elasticsearch 中,text 用于全文搜索,keyword 用于精确值聚合/排序;混用两者会产生该错误。
解决方法
使用字段的 keyword 子字段进行聚合/排序(如 "my_field.keyword")。如果该字段只有 text 类型,在 mapping 中添加 keyword 子字段(multi-field)并执行 _reindex。可以在 text 字段上启用 fielddata(fielddata=true),但由于内存消耗高并有熔断风险,不推荐;只在不可避免时使用。
同一数据库的其他条目
- 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(mapping 设为 strict,不允许动态添加字段)
- search_phase_execution_exceptionsearch_phase_execution_exception: all shards failed / Failed to execute phase [query](所有分片均失败 / 执行 [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(文档不存在)