如何在elasticsearch中计算内部命中分数?

wlp8pajw  于 2021-06-10  发布在  ElasticSearch
关注(0)|答案(1)|浏览(312)

例如,我有一个嵌套文档,如:

doc = {  
  "id": 1,  
  "content": [  
    {  
      "txt": apple,  
      "time": 0,  
    },  
    {  
      "txt": banana,  
      "time": 1,  
    },  
    {  
      "txt": water,  
      "time": 2,  
    },  
    {  
      "txt": do not match this block,  
      "time": 3,  
    },  
  ]  
}

当我搜索“苹果、香蕉或水”时,我只从最大内击分数中得到分数,但我想从内击分数的总和中得到分数。
也许我应该用聚合?

xxhby3vn

xxhby3vn1#

添加“score\u mode”:“sum”在搜索查询中

相关问题