TermQuery formation when searching a JSON object against a non analyzed string

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

  1. assignee:profile_id
  2. assignee:neha
  3. assignee:{
  4. 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?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.