search - How to combine Elasticsearch highlighting and query types? -


if search like:

{   "query" : {     "bool" : {       "should" : [           {"match" : { "fullname" : "middlename1" } },           {"match_phrase" : { "fullname" : "firstname2 lastname2" } }       ]     }       } } 

i documents like:

{ ... "_id": "1", ...   "fullname" : "firstname1 middlename1 lastname1", ... }  { ... "_id": "2" ...   "fullname" : "firstname2 lastname2", ... } 

i know highlighting shows parts of documents caused retrievals, not query type. can multi query merge results.

is there way single query , find out query type fields , tokens caused documents retrieved?

ideal result:

{   "id" : "1",   "clause" : "match",   "field" : "fullname",   "tokens" : ["middlename1"] }  {   "id" : "2",   "clause" : "match_phrase",   "field" : "fullname",   "tokens" : ["firstname2", "lastname2"] } 


Comments