预先创建索引导致的No mapping found for [xxx_field] in order to sort on问题
Elasticsearch | 作者 wangxinrong | 发布于2020年03月31日 | 阅读数:6267
我的es每天会提前创建第二天的索引,假如有indexA的话,3.31号就会创建好indexA-2020.04.01的索引
这样会有个问题,当有人用 indexA-* 进行查询,并且查询语句中用到sort时,ES日志中会报 indexA-2020.04.01 的 No mapping found for [xxx_field] in order to sort on 错误。
网上通常的做法是在查询语句中加上"ignore_unmapped": true,但用户的行为我没办法控制,有没有办法在集群或索引设置上避免产生这个报错呢?
这样会有个问题,当有人用 indexA-* 进行查询,并且查询语句中用到sort时,ES日志中会报 indexA-2020.04.01 的 No mapping found for [xxx_field] in order to sort on 错误。
网上通常的做法是在查询语句中加上"ignore_unmapped": true,但用户的行为我没办法控制,有没有办法在集群或索引设置上避免产生这个报错呢?
2 个回复
dadaball
赞同来自:
byx313 - BLOG:https://www.jianshu.com/u/43fd06f9589c
赞同来自: