Hi,
I am searching a particular word using highlight query.
I am using two different queries
1.
body: { query: { match_phrase: { "attachment.content": searchedWord } }, highlight : { order : "score", require_field_match: false, fields : { "attachment.content" : { } } } }
- Another is
body: { "_source": false, query: { "bool": { "must": [ {"terms": {"_id":[id]}} ], "should": { "match": {"attachment.content": searchedWord}} } }, "highlight" : { "pre_tags":"<mark>", "post_tags":"</mark>", "fields" : { "attachment.content" : { "number_of_fragments" : 0 } } } }
Thing is that if I search for a word let say for example "exchange" So basically in my document this word appears for 11 times. My first query returns me 6 fragments
whereas when I run my next query with number_of_fragments: 0 I get all the 11 results with my pre and post tags
What should I do so that I will get all the 11 searches as 11 fragments in my first query?