I have a mapping like
{:assignee {:type "string"
:include_in_all false
:index "not_analyzed"
:null_value "unassigned"}}
If I want to search a document with assignee as "neha" my query would be
{"query": {"bool": {"must": [{"term": {"assignee":"neha"}}]}}}
This works perfectly fine.
What I want to understand is when I pass an JSON object other than string as assignee to terms query, the query execution shows that it is being converted into 4 termQueries for example:
{"query": {"bool": {"must": [{"terms": {"assignee": [{"profile_id":"neha"}]}}]}}}
Following TermQueries are being used
- assignee:profile_id
- assignee:neha
- assignee:{
- assignee:}
As a result ES still returns search hits because of the second TermQuery. Here assignee is a not analyzed string. Then why are 4 TermQueries being formed here?
Is this intentional? If not then what would be the use case here?