如何根据内部匹配的得分排序

返回儿童分数,但是它没有按顺序排序。 我尝试添加“ function_score”和“ score_mode”:最大值。但是,它仍然没有按顺序排列。不太清楚我应该怎么做才能使其正常工作。 好心提醒。

POST _scripts/my_script
{

  "script" : {
    "lang" : "mustache","source" : """
 {
  "size": 200,"query":{
    "function_score":{
  "query": {
    "bool": {
      "should": [
        {
          "match": {
            "name": {
              "query": "{{query}}",}
          }
        },{
          "has_child": {
            "type": "phone","score_mode": "max","inner_hits": {
              "highlight": {
                "fields": {
                  "*": {

                  }
                }
              }
            },"query": {
              "match": {
                "phone_number": {
                  "query" :"{{query}}",}
              }
            }
          }
        },{
          "has_child": {
            "type": "product","query": {
              "match": {
                "product_num": {
                  "query" :"{{query}}"
                }
              }
            }
          }
        }
      ]
    }
  }
    }
  }
}
    """
  }
}

预期的内部匹配项将按desc顺序排序,但未排序。

erma001 回答:如何根据内部匹配的得分排序

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3169118.html

大家都在问