In my index, there is a document that has ident_key = a, but none with ident_key = b.
Now this query returns one hit:
GET _search
{
"query": {
"bool": {
"filter": [
{
"term": {
"ident_key": "a"
}
}
],
"should": [
{
"term": {
"ident_key": "b"
}
}
]
}
}
}
But this query returns no hits:
GET _search
{
"filter": {
"bool": {
"filter": [
{
"term": {
"ident_key": "a"
}
}
],
"should": [
{
"term": {
"ident_key": "b"
}
}
]
}
}
}
The only difference is the outermost filter instead of query.
I don't understand this behavior. Does a bool query work differently in query context than in filter context (apart from the scoring)?
This is Elasticsearch 2.1.