-
异常信息:
Fielddata is disabled on text fields by default. Set fielddata=true on [my_field] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.
-
解决办法:
默认情况下 text 字段的 Fielddata 是禁用的。如果对 text 字段中的进行排序,汇总或访问值,则会看到上述异常。
可以对 text 字段上启用 Fielddata 解决。curl -X PUT "localhost:9200/my_index/_mapping?pretty" -H 'Content-Type: application/json' -d' { "properties": { "my_field": { "type": "text", "fielddata": true } } } '
参考: https://www.elastic.co/guide/en/elasticsearch/reference/current/fielddata.html