我想用 ElasticSearch 实现以下查询:
product_shipper = 1 AND ((product_type = product and price>0) OR (product_type = product_variation and price=0))
我已经构建了以下查询,但它不起作用,给我发送了一个空结果:
"query"=> [
"bool"=> [
"must"=> [
[
"bool"=> [
"should" => [
"bool"=> [
"must"=> [
[ "match" => [ "product_type" => "product" ] ],
[
'range'=>['price'=>['gt'=>0]]
],
]
],
"bool"=> [
"must"=> [
[ "match" => [ "product_type" => "product_variation" ] ],
[ "match" => [ "price" => 0 ] ]
]
]
]
]
],
[ 'match' => [ 'product_shipper' => $shipper ] ],
]
]
]
我究竟做错了什么?