ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception

ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Fielddata is disabled on text fields by default. Set fielddata=true on [categoryName] 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类型,在es中,只有keyword类型的字符串可以分组聚合,读取数据库会将字符串读取为text类型,属于动态映射,想要分组查询,利用静态映射自定义字符串类型即可
=v=

你可能感兴趣的:(错误)