elasticsearch - retrieve a document using _id field that its one field contains highlighted words in elsaticsearch -
i want access document in index directly using _id field , want highlight word in messagetext
field, this, created below query highlight
attribute not appear in result response.
{ "query":{ "term":{ "_id": "1006382869737" } }, "highlight" : { "tags_schema" : "styled", "fields" : { "messagetext" : { "highlight_query":{ "term": { "messagetext":"car" } } } } } }
i'm sure car
occurred in messagetext
field document id 1006382869737
. i'm sure highlights
must exist in response, it's not.
if important i'm using 2.3.4 version of elasticsearch. , query has been created according documentation. i'm not sure rescore_query
in documentation, if important please tell me how edit query, else give me suggestion.
tnx :)
additional information
i try below query:
{ "query":{ "bool": { "must":[ { "term":{ "_id": "1006382869737" } }, { "term": { "messagetext":"car" } } ] } }, "highlight" : { "fields" : { "messagetext" : {} } } }
but causes no document hits.
i found solution: data comes server haven't access code. after many debugging figure out in cases server send text data in field named caption
. unfortunately server has not documentation, causes problem.
finally find problem , add more highlight_query caption
field , it's work fine now.
Comments
Post a Comment