小编jil*_*esh的帖子

Elasticsearch - 希望在该特定字段可用或不可用的所有索引中按字段排序,如果不可用,则避免它

目前,根据评分获取结果但我想要做的是我想要基于评分+字段状态的结果,值为真/假。

如果值为真,则需要导致优先级,但有可能并非所有索引中都存在状态字段

           "query" => [
                  'bool' => [
                     'filter' => $filter,
                     'must' => [
                     "multi_match" => [
                        'query' => "$string",
                        "type" => "cross_fields",
                        'fields' => ['field1','field2','field3'],
                        "minimum_should_match" => "80%"
                         ]
                    ]
                  ]
            ],
            "sort" => [
                    "_score",
                    [ "status" => ["order" => "desc","unmapped_type" => "boolean"] ]
            ],
Run Code Online (Sandbox Code Playgroud)

但得到以下错误:

[type] => illegal_argument_exception
[reason] => Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by …
Run Code Online (Sandbox Code Playgroud)

php search elasticsearch elastic-stack elk

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

elastic-stack ×1

elasticsearch ×1

elk ×1

php ×1

search ×1