目前,根据评分获取结果,但我想做的是我想要一个基于评分 + 字段状态的结果,值为 true/false。
如果值为真,则需要导致优先级,但状态字段可能不存在于所有索引中。
"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"] ]
],
但出现以下错误:
[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 default. Please use a keyword field instead. Alternatively, set fielddata=true on [status] in order to load field data by uninverting the inverted index. Note that this can use significant memory.
有人帮我忽略该字段不可用的索引或解决此问题的任何其他解决方案吗?
芜湖不芜
皈依舞
大话西游666