Combination of two different filters in one Query - Elastica Combination of two different filters in one Query - Elastica elasticsearch elasticsearch

Combination of two different filters in one Query - Elastica


Why don't you add the range filter as another must term in the bool filter:

$rangeFilter = new Elastica_Filter_Range();$rangeFilter->addField('date',                     array(  'from' => $datepicker,                            'to' => $datepicker1                         )                  ); $elasticaFilterBool->addMust($rangeFilter);$elasticaQuery->setFilter($elasticaFilterBool);

You need to use filters, not queries, in a boolean filter. Note I have used Elastica_Filter_Range instead of the range query you were using.

Also, you know you are using an outdated version of Elastica, the new ones use namespaces!