-
異常信息:
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