Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sorting 弹性搜索使用另一个字段值对分数相同的文档进行排序_Sorting_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch - Fatal编程技术网 elasticsearch,Sorting,elasticsearch" /> elasticsearch,Sorting,elasticsearch" />

Sorting 弹性搜索使用另一个字段值对分数相同的文档进行排序

Sorting 弹性搜索使用另一个字段值对分数相同的文档进行排序,sorting,elasticsearch,Sorting,elasticsearch,我使用的是弹性搜索,我想根据存储在所有文档中的“喜欢”字段-整数类型的较高数量,对与下面显示的查询分数相同的文档进行排序。代码- query: { multi_match: { query: "some cooler", type: "most_fields", fields: ["info1", "info2", "in

我使用的是弹性搜索,我想根据存储在所有文档中的“喜欢”字段-整数类型的较高数量,对与下面显示的查询分数相同的文档进行排序。代码-

query: {
                multi_match: {
                        query: "some cooler",
                        type: "most_fields",
                        fields: ["info1", "info2", "info3"]
                }
        }
你应该检查一下房间

只需在json排序中添加一个排序部分,然后是自定义字段

{
    "query" : {...},
    "sort" : [
        "_score",
        { "likes" : {"order" : "desc"}}
    ]
}
默认情况下,分数顺序为“desc”。默认情况下,其他字段为“asc”,因此如果需要,您需要为“likes”字段定义“desc”顺序