I am new to ElasticSearch and trying to use geo_bounding_box and geo_polygon filters together in a search. They work if I use them separately one by one. But if I try using them, it gives me error. Here is my code.
$json = [
'query' => [
'bool' => [
'must_not' => [
['terms' => ['_id' => []]],
['terms' => ['rarity' => []]]
],
'must' => [
'range' => [
'disappearTime' => [
'gte' => 'now',
'lte' => 'now+1d'
]
]
],
'filter' => [
'geo_bounding_box' => [
'location' => [
'top_left' => [
'lat' => 52.280577919216356,
'lon' => -113.78533601760866
],
'bottom_right' => [
'lat' => 52.26306210545918,
'lon' => -113.81855249404909
]
]
],
'geo_polygon' => [
'location' => [
"points" => [
[-113.78721646175813, 52.29637194474555],
[-113.76335508934484, 52.281770664368565],
[-113.76335508934484, 52.26112133563143],
[-113.78721646175813, 52.24652005525444],
[-113.82096153824187, 52.24652005525444],
[-113.84482291065517, 52.26112133563143],
[-113.84482291065517, 52.281770664368565],
[-113.82096153824187, 52.29637194474555],
[-113.78721646175813, 52.29637194474555],
[-113.69997059121626, 52.298658944745554],
[-113.67610798767082, 52.28405766436857],
[-113.67610798767082, 52.26340833563143],
[-113.69997059121626, 52.248807055254446],
[-113.73371740878373, 52.248807055254446],
[-113.75758001232917, 52.26340833563143],
[-113.75758001232917, 52.28405766436857],
[-113.73371740878373, 52.298658944745554],
[-113.69997059121626, 52.298658944745554]
]
]
]
]
]
]
];
Any help would be greatly appreciated. Thanks