es报错all shards failed:Fielddata is disabled on text fields by default. Set fielddata=true on

es报错all shards failed:Fielddata is disabled on text fields by default. Set fielddata=true on,第1张

es报错all shards failed:Fielddata is disabled on text fields by default. Set fielddata=true on

今天新环境es客户端查询的时候发现这个异常
java.lang.IllegalArgumentException: Fielddata is disabled on text fields by default. Set fielddata=true on [node_id] 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.

java.lang.IllegalArgumentException: Fielddata is disabled on text fields by default. Set fielddata=true on [node_id] 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.
        at org.elasticsearch.index.mapper.TextFieldMapper$TextFieldType.fielddataBuilder(TextFieldMapper.java:336)
        at org.elasticsearch.index.fielddata.IndexFieldDataService.getForField(IndexFieldDataService.java:111)
        at org.elasticsearch.index.query.QueryShardContext.getForField(QueryShardContext.java:166)
        at org.elasticsearch.search.aggregations.support.ValuesSourceConfig.resolve(ValuesSourceConfig.java:97)
        at org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder.resolveConfig(ValuesSourceAggregationBuilder.java:297)
        at org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder.doBuild(ValuesSourceAggregationBuilder.java:290)
        at org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder.doBuild(ValuesSourceAggregationBuilder.java:39)
        at org.elasticsearch.search.aggregations.AbstractAggregationBuilder.build(AbstractAggregationBuilder.java:126)
        at org.elasticsearch.search.aggregations.AggregatorFactories$Builder.build(AggregatorFactories.java:333)
        at org.elasticsearch.search.SearchService.parseSource(SearchService.java:642)
        at org.elasticsearch.search.SearchService.createContext(SearchService.java:472)
        at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:448)
        at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:252)
        at org.elasticsearch.action.search.SearchTransportService.messageReceived(SearchTransportService.java:339)


网上其他的也可以看看 但是没有解决我的问题
我的es是5.4.x版本的
然后开始冥思
说明一下

我们使用了es的索引模板

很有可能是在索引模板未创建时,此时就存入数据

故导致客户端代码进行排序或者分组的时候 出现 all shards failed

然后开始尝试
1.加入索引模板

还是不行

2.清除之前未有索引模板创建的索引及数据
重启,问题解决

命令为:curl -XDELETE http://ip:9200/索引名

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5705544.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存