找到问题的解决办法了么?

next_doc耗时较长怎么优化?

Elasticsearch | 作者 ridethewind | 发布于2019年03月26日 | 阅读数:3657


20190326-142744(eSpace).png

我的dsl如下:
{"query": { "bool":{"filter":{"bool":{"must":[{"term" : {  "ALL" :"iwc" }},{"term" : {  "ALL" :"wca" }},{"term" : {  "ALL" :"cae" }},{"term" : {  "ALL" :"aeg" }},{"term" : {  "ALL" :"egs" }},{"term" : {  "ALL" :"gsp" }},{"term" : {  "ALL" :"spd" }},{"term" : {  "ALL" :"pds" }},{"term" : {  "ALL" :"dse" }},{"term" : {  "ALL" :"sex" }},{"term" : {  "ALL" :"exw" }},{"term" : {  "ALL" :"xwt" }},{"term" : {  "ALL" :"wth" }},{"term" : {  "ALL" :"thq" }},{"term" : {  "ALL" :"hqu" }},{"term" : {  "ALL" :"qut" }},{"term" : {  "ALL" :"utu" }},{"term" : {  "ALL" :"tur" }},{"term" : {  "ALL" :"urf" }},{"term" : {  "ALL" :"rfv" }},{"term" : {  "ALL" :"fvk" }},{"term" : {  "ALL" :"vkp" }},{"term" : {  "ALL" :"kpm" }},{"term" : {  "ALL" :"pma" }},{"term" : {  "ALL" :"map" }},{"term" : {  "ALL" :"apc" }},{"term" : {  "ALL" :"pcz" }},{"term" : {  "ALL" :"czz" }}]}}}}}
1. nextdoc耗时较多如何优化?
2. 我加了filter,理论上是不评分的,为什么还有builder_scorer的开销?
已邀请:

hanbj

赞同来自: Merrizee

因为你filter里面是一个boolean查询,filter里面的query会被封装成
ConstantScoreQuery,lucene会对query进行重写,BooleanQuery会构造一个score对象树,也就是说BooleanQuery还是会对文档打分的,只是外层的ConstantScoreScore统一返回0
 
你可以包装每个查询用ConstantScore查询,不需要放在fliter里面,另外filter也会缓存,如果缓存的数据量很大,在构建缓存的bit时很耗时

要回复问题请先登录注册