ElasticSearch:数组大小里面的查询不能超过1000个索引 [英] ElasticSearch: array size inside of terms query cannot exceed 1000 indices

查看:338
本文介绍了ElasticSearch:数组大小里面的查询不能超过1000个索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样的查询:


filter:{
query:{
条款:{user:[jonh,doe,...,asdf]}
}
}

数组中的用户数量对于我们的用例是任意大的。但是,ElasticSearch似乎失败了SearchPhaseExecutionException [无法执行阶段[查询],完全失败; 当数组的大小超过 1027

The number of users in the array is arbitrarily big for our use case. However, ElasticSearch seems to fail with "SearchPhaseExecutionException[Failed to execute phase [query], total failure; when the size of the array surpasses 1027.

这是预期的行为吗?如果是,有没有办法增加接受的数组的大小?

Is this the expected behavior? If so, is there a way to increase the size of the accepted array?

推荐答案

您的请求正在使用术语查询,将其转换为布尔查询,默认情况下不接受1024但是,由于您稍后将其用作过滤器,切换到使用不具有此限制的术语过滤器将更快,您只需删除<您的请求中的href =http://www.elasticsearch.org/guide/reference/query-dsl/query-filter/>查询过滤器:

Your request is using terms query, which is getting translated into boolean query, which by default doesn't accept more than 1024 terms. However, since you are using it as a filter later on, it will be actually faster to switch to using terms filter, which doesn't have this limitation. All you have to do is remove query filter from your request:

"filter": { "terms": { "user": ["jonh", "doe", ..., "asdf"]} }

这篇关于ElasticSearch:数组大小里面的查询不能超过1000个索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆