Reputation: 31
I have 2 below elastic search query
This give 5 result
POST twitter/object/_search
{
"_source": false,
"query": {
"query_string": {
"query": "Apple AND Orange OR Banana",
"default_field": "content"
}
}
}
This give 12 result
POST twitter/object/_search
{
"_source": false,
"query": {
"query_string": {
"query": "(Apple AND Orange) OR Banana",
"default_field": "content"
}
}
}
Please help me out why it's happening. How the query is interpret because logically both queries should give same output?
Upvotes: 2
Views: 2137
Reputation: 1691
The familiar boolean operators AND, OR and NOT are supported but beware that they do not honor the usual precedence rules, so parentheses should be used whenever multiple operators are used together.
Upvotes: 1