{ "query": { "bool": { "must": { "term": { "type.keyword": "test" } } } }, "from": 0, "size": 0, "sort": [ { "msg_time": { "order": "desc" } } ], "aggs": { "myName": { "terms": { "field": "xxxx" } } } }
报错信息如下:
Fielddata is disabled on text fields by default. Set fielddata=true on [title] 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.
使用ES版本为:5.1.1
解决办法: