I have this query (via PHP client) for ElasticSearch 6.2:
[
"query"=> [
"bool" => [
"filter" => [
"term" => [ "row.name" => $name ],
"term" => [ "row.origin" => $origin ]
]
]
],
"size" => "10"
]
It works if I use just one search for either row.name or row.origin, but with both it works like an OR and returns all results. How can I filter to only return documents that are an exact match for row.name AND row.origin
You took the right way, but I'm guessing that you missed parenthesis.
Instead of:
You should have:
In your case you created a map with two same (
term) keys:So the second
termoverrode the first one and in reality, you sent:To send multiple
termfilters you need so they will be treated as a list: