Help please get data from the elastic index.
The situation is the following - in the availability array we have the availability of certain hotel rooms for each day (in the example for 2 weeks).
The keys in the array are id numbers. The array values are nested arrays with key-date and availability (1 - available for booking, 0 - not available).
It is necessary to send a request so that the hotels, which have certain days, at least in one of the rooms, have the value 1 (available).
Documents have the following mapping:
[_index] => placement [_type] => hotel [_id] => 26 [_version] => 15 [found] => 1 [_source] => Array ( [id] => 26 [name] => Гостиница 1 [type_id] => 1 [review_count] => 65 [order_count] => 429 [spa_id] => 3 [object_id] => 4 [spa] => 3 [availability] => Array ( [258] => Array ( [2016-03-30] => 0 [2016-03-31] => 1 [2016-04-01] => 0 [2016-04-02] => 0 [2016-04-03] => 1 [2016-04-04] => 1 [2016-04-05] => 0 [2016-04-06] => 0 [2016-04-07] => 0 [2016-04-08] => 1 [2016-04-09] => 0 [2016-04-10] => 1 [2016-04-11] => 1 [2016-04-12] => 1 [2016-04-13] => 1 ) [259] => Array ( [2016-03-30] => 0 [2016-03-31] => 1 [2016-04-01] => 0 [2016-04-02] => 0 [2016-04-03] => 0 [2016-04-04] => 1 [2016-04-05] => 0 [2016-04-06] => 0 [2016-04-07] => 0 [2016-04-08] => 1 [2016-04-09] => 1 [2016-04-10] => 1 [2016-04-11] => 1 [2016-04-12] => 1 [2016-04-13] => 1 ) [260] => Array ( [2016-03-30] => 0 [2016-03-31] => 0 [2016-04-01] => 0 [2016-04-02] => 0 [2016-04-03] => 0 [2016-04-04] => 0 [2016-04-05] => 0 [2016-04-06] => 0 [2016-04-07] => 0 [2016-04-08] => 1 [2016-04-09] => 1 [2016-04-10] => 1 [2016-04-11] => 1 [2016-04-12] => 1 [2016-04-13] => 1 ) ) ) )
Here is the query I tried to send using the client for PHP:
array(4) { ["index"]=> string(9) "placement" ["type"]=> string(5) "hotel" ["size"]=> int(1000) ["body"]=> array(1) { ["query"]=> array(1) { ["bool"]=> array(1) { ["must"]=> array(3) { [0]=> array(1) { ["term"]=> array(1) { ["spa_id"]=> int(3) } } [2]=> array(1) { ["bool"]=> array(1) { ["must"]=> array(5) { [0]=> array(1) { ["term"]=> array(1) { ["availability.2016-04-09"]=> int(1) } } [1]=> array(1) { ["term"]=> array(1) { ["availability.2016-04-10"]=> int(1) } } [2]=> array(1) { ["term"]=> array(1) { ["availability.2016-04-11"]=> int(1) } } [3]=> array(1) { ["term"]=> array(1) { ["availability.2016-04-12"]=> int(1) } } [4]=> array(1) { ["term"]=> array(1) { ["availability.2016-04-13"]=> int(1) } } } } } } } } } }