admin管理员组

文章数量:1531450

org.elasticsearch.ElasticsearchException: 
Elasticsearch exception [type=illegal_argument_exception, reason=Text fields are not optimised for operations 
that require per-document field data like aggregations and sorting,
so these operations are disabled by default.
Please use a keyword field instead. Alternatively, set fielddata=true on [starName] in order to load field data by uninverting the inverted index. Note that this can use significant memory.]

报错信息如上所示,这其实是很典型的一个错,也很容易忽略。其实这段话读下来也知道是什么问题了,

因为分组聚合查询的字段类型是text类型, 使用term查询是精准匹配,字段类型必须是keyword类型

所以只需要在所提示的字段后面加个.keyword就可,我这里是starName有问题,所以就在它后面加就好了。

本文标签: 时报ElasticsearchException