Hello,World

es in查询超时问题

Elasticsearch | 作者 pinoc | 发布于2020年08月11日 | 阅读数:2201

目前使用elasticsearch 的termsQuery操作组装in查询条件, in条件约2000+ ,导致了es的查询超时问题, 请问如何解决,有替代方案么,
{
"from" : 0,
"size" : 20,
"query" : {
"bool" : {
"must" : [ {
"range" : {
"bind_time" : {
"from" : 1594483200000,
"to" : 1597161599000,
"include_lower" : true,
"include_upper" : true
}
}
}, {
"terms" : {
"assistant_id" : [ 16113, 16116, 16120, 16121, 16123, 17664, 17735, 17737, 17738, 18689, 18957, 19113 ]
}
}, {
"terms" : {
"customer_id" : [ 8730756, 9085067, 8716418, 9050253, 9070722, 9074817........ 8607887, 8984709, 9050247, 9050267, 8870047, 8999057, 9058450, 716816, 3289132 ]
}
} ]
}
},
"sort" : [ {
"bind_time" : {
"order" : "desc",
"missing" : "_last"
}
} ]
}
customer_id 条件约为2000+条
已邀请:

liuxg - Elastic

赞同来自:

你可以使用异步请求吗? https://elasticstack.blog.csdn ... 68114

viewsite

赞同来自:

es 版本? 请求耗时多久? profile 结果 ?

pony_maggie - 公众号:犀牛饲养员的技术笔记

赞同来自:

查询改为filter context试试

要回复问题请先登录注册