搜索结果正在快递途中

build_scorer时间过长

Elasticsearch | 作者 elasticStack | 发布于2021年09月14日 | 阅读数:1740


  "track_total_hits": true, 
  "_source": {
    "includes": []
  },
  "query": {
    "bool": {
      "filter": [
        {
          "bool": {
            "filter": [
              {
                "bool": {
                  "must_not": [
                    {
                      "bool": {
                        "should": [
                          {
                            "bool": {
                              "should": [
                                {
                                  "bool": {
                                    "filter": [
                                      {
                                        "terms": {
                                          "pname.keyword": [
                                            "awk"
                                          ]
                                        }
                                      },
                                      {
                                        "terms": {
                                          "datatype": [
                                            "proc_create"
                                          ]
                                        }
                                      }
                                    ]
                                  }
                                },
                                {
                                  "bool": {
                                    "filter": [
                                      {
                                        "terms": {
                                          "pname.keyword": [
                                            "java"
                                          ]
                                        }
                                      },
                                      {
                                        "terms": {
                                          "datatype": [
                                            "proc_create"
                                          ]
                                        }
                                      }
                                    ]
                                  }
                                }
                              ],
                              "minimum_should_match": 1
                            }
                          }
                        ],
                        "minimum_should_match": 1
                      }
                    }
                  ]
                }
              },
              {
                "bool": {
                  "filter": [
                    {
                      "range": {
                        "datatime": {
                          "gte": 1631610102
                        }
                      }
                    },
                    {
                      "range": {
                        "datatime": {
                          "lte": 1631613702
                        }
                      }
                    }
                  ]
                }
              },
              {
                "bool": {
                  "must_not": [
                    {
                      "term": {
                        "pname.keyword": "flanneld"
                      }
                    }
                  ]
                }
              }
            ]
          }
        }
      ]
    }
  },
  "sort": [
    {
      "datatime": {
        "order": "desc"
      }
    }
  ]
}
已邀请:

elasticStack - 90后it大数据男

赞同来自:

ES版本:7.X
 
数据量: 1亿左右
 
dsl和profile见附件, 请大佬指点优化方向

God_lockin

赞同来自:

要不要考虑把query合并一下,或者换个思路,should的条件拆成多个并发的取,然后在内存中合并?
 

laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net

赞同来自:

第一反应:嵌套那么多层,是否有优化的空间,从这个思路排查一下看看。

要回复问题请先登录注册