Can't use two ore more filters

My Elasticsearch query is like that:

When I remove one of the filters terms for example fk_product_group it works perfectly but when use both filters I get fatal error with code 400 Bad request.

Hi @nagiyevel,

you have to nest your query differently as the term query does only support one term. See also the bool query docs.

In your example you need to do something along the lines of:

[filter] => Array(
    [bool] => Array(
        [must] => Array(
            [term] => Array(
                [fk_product_category] => 1
            ),
            [term] => Array(
                [fk_product_group] => 1
            )
        )
    )
) 

although I am not sure whether you need the Array also for the term query (maybe that's specific to your program language which I do not recognize from this example).

Daniel

Thank you @danielmitterdorfer .
It's working.

Hi Elchin,

That's great to hear and glad I could help. :slight_smile:

Daniel