# Highlight missing for multi-word text phrase query with non zero slop

**URL:** <https://discuss.elastic.co/t/highlight-missing-for-multi-word-text-phrase-query-with-non-zero-slop/6765>\
**Category:** Elasticsearch\
**Created:** [February 21, 2012, 8:21am UTC](https://discuss.elastic.co/t/highlight-missing-for-multi-word-text-phrase-query-with-non-zero-slop/6765 "2012-02-21T08:21:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![alphauser](https://avatars.discourse-cdn.com/v4/letter/a/b5ac83/32.png) [@alphauser](https://discuss.elastic.co/u/alphauser)\
**Post date:** [February 21, 2012, 8:21am UTC](https://discuss.elastic.co/t/highlight-missing-for-multi-word-text-phrase-query-with-non-zero-slop/6765/1 "2012-02-21T08:21:59Z")

</div>

Just noticed a weird issue where highlight for a few search results  
are missing in case of text phrase query with slop 3(in my case) for a  
multi-word query(where order of words in query is not same as in  
document).

E.g.  
Tested on Versions - 0.18.6/0.18.7

Mapping for field:

"raw\_content":{  
"index\_analyzer":"snowball",  
"search\_analyzer":"snowball",  
"boost":0.5,  
"index": "analyzed",  
"store": "yes",  
"type": u"string",  
"term\_vector" : "with\_positions\_offsets"},

Query:

"query": {"text": {"raw\_content": {"query": "good people", "type":  
"phrase", "slop": 3}}}

Actual text in raw\_content field:

"... public health and the movement of people and goods, and other  
factors ..."

Above document is present in the search results but highlights are  
missing instead if I reverse search terms as mentioned below.

Query:

"query": {"text": {"raw\_content": {"query": "people good", "type":  
"phrase", "slop": 3}}}

Now, I have document with highlights present.

It seems order of words in multi-words query is important in case of  
slop but search is working perfectly either ways only highlights are  
failing.

Pardon me if I am missing some basic stuff and do consider if its a  
genuine issue.

---

<div class="post-metadata">

**Author:** ![alphauser](https://avatars.discourse-cdn.com/v4/letter/a/b5ac83/32.png) [@alphauser](https://discuss.elastic.co/u/alphauser)\
**Post date:** [February 21, 2012, 9:02am UTC](https://discuss.elastic.co/t/highlight-missing-for-multi-word-text-phrase-query-with-non-zero-slop/6765/2 "2012-02-21T09:02:44Z")

</div>

A Small Update:

Tested scenario with span\_near query with in\_order:false. Still  
highlights are missing.

Query:  
"query": {"span\_near": {"in\_order": false, "clauses": [{"span\_term":  
{"raw\_content": "good"}}, {"span\_term": {"raw\_content": "people"}}],  
"slop": 3}}

On Feb 21, 1:21 pm, Raj [rajdeepn...@gmail.com](mailto:rajdeepn...@gmail.com) wrote:

> Just noticed a weird issue where highlight for a few search results  
> are missing in case of text phrase query with slop 3(in my case) for a  
> multi-word query(where order of words in query is not same as in  
> document).
> 
> E.g.  
> Tested on Versions - 0.18.6/0.18.7
> 
> Mapping for field:
> 
> "raw\_content":{  
> "index\_analyzer":"snowball",  
> "search\_analyzer":"snowball",  
> "boost":0.5,  
> "index": "analyzed",  
> "store": "yes",  
> "type": u"string",  
> "term\_vector" : "with\_positions\_offsets"},
> 
> Query:
> 
> "query": {"text": {"raw\_content": {"query": "good people", "type":  
> "phrase", "slop": 3}}}
> 
> Actual text in raw\_content field:
> 
> "... public health and the movement of people and goods, and other  
> factors ..."
> 
> Above document is present in the search results but highlights are  
> missing instead if I reverse search terms as mentioned below.
> 
> Query:
> 
> "query": {"text": {"raw\_content": {"query": "people good", "type":  
> "phrase", "slop": 3}}}
> 
> Now, I have document with highlights present.
> 
> It seems order of words in multi-words query is important in case of  
> slop but search is working perfectly either ways only highlights are  
> failing.
> 
> Pardon me if I am missing some basic stuff and do consider if its a  
> genuine issue.

---

<div class="post-metadata">

**Author:** ![Robert\_2](https://avatars.discourse-cdn.com/v4/letter/r/7ea924/32.png) [@Robert\_2](https://discuss.elastic.co/u/Robert_2)\
**Post date:** [May 24, 2012, 4:35pm UTC](https://discuss.elastic.co/t/highlight-missing-for-multi-word-text-phrase-query-with-non-zero-slop/6765/3 "2012-05-24T16:35:54Z")

</div>

I am seeing this same issue as well, where a proximity search in a  
query\_string matches (order doesn't matter) yet the fast vector highlighter  
returns no highlighted content (unless in correct order).

Any updates on this issue?

On Tuesday, February 21, 2012 4:02:44 AM UTC-5, Raj wrote:

> A Small Update:
> 
> Tested scenario with span\_near query with in\_order:false. Still  
> highlights are missing.
> 
> Query:  
> "query": {"span\_near": {"in\_order": false, "clauses": [{"span\_term":  
> {"raw\_content": "good"}}, {"span\_term": {"raw\_content": "people"}}],  
> "slop": 3}}
> 
> On Feb 21, 1:21 pm, Raj [rajdeepn...@gmail.com](mailto:rajdeepn...@gmail.com) wrote:
> 
> > Just noticed a weird issue where highlight for a few search results  
> > are missing in case of text phrase query with slop 3(in my case) for a  
> > multi-word query(where order of words in query is not same as in  
> > document).
> > 
> > E.g.  
> > Tested on Versions - 0.18.6/0.18.7
> > 
> > Mapping for field:
> > 
> > "raw\_content":{  
> > "index\_analyzer":"snowball",  
> > "search\_analyzer":"snowball",  
> > "boost":0.5,  
> > "index": "analyzed",  
> > "store": "yes",  
> > "type": u"string",  
> > "term\_vector" : "with\_positions\_offsets"},
> > 
> > Query:
> > 
> > "query": {"text": {"raw\_content": {"query": "good people", "type":  
> > "phrase", "slop": 3}}}
> > 
> > Actual text in raw\_content field:
> > 
> > "... public health and the movement of people and goods, and other  
> > factors ..."
> > 
> > Above document is present in the search results but highlights are  
> > missing instead if I reverse search terms as mentioned below.
> > 
> > Query:
> > 
> > "query": {"text": {"raw\_content": {"query": "people good", "type":  
> > "phrase", "slop": 3}}}
> > 
> > Now, I have document with highlights present.
> > 
> > It seems order of words in multi-words query is important in case of  
> > slop but search is working perfectly either ways only highlights are  
> > failing.
> > 
> > Pardon me if I am missing some basic stuff and do consider if its a  
> > genuine issue.

On Tuesday, February 21, 2012 4:02:44 AM UTC-5, Raj wrote:

> A Small Update:
> 
> Tested scenario with span\_near query with in\_order:false. Still  
> highlights are missing.
> 
> Query:  
> "query": {"span\_near": {"in\_order": false, "clauses": [{"span\_term":  
> {"raw\_content": "good"}}, {"span\_term": {"raw\_content": "people"}}],  
> "slop": 3}}
> 
> On Feb 21, 1:21 pm, Raj [rajdeepn...@gmail.com](mailto:rajdeepn...@gmail.com) wrote:
> 
> > Just noticed a weird issue where highlight for a few search results  
> > are missing in case of text phrase query with slop 3(in my case) for a  
> > multi-word query(where order of words in query is not same as in  
> > document).
> > 
> > E.g.  
> > Tested on Versions - 0.18.6/0.18.7
> > 
> > Mapping for field:
> > 
> > "raw\_content":{  
> > "index\_analyzer":"snowball",  
> > "search\_analyzer":"snowball",  
> > "boost":0.5,  
> > "index": "analyzed",  
> > "store": "yes",  
> > "type": u"string",  
> > "term\_vector" : "with\_positions\_offsets"},
> > 
> > Query:
> > 
> > "query": {"text": {"raw\_content": {"query": "good people", "type":  
> > "phrase", "slop": 3}}}
> > 
> > Actual text in raw\_content field:
> > 
> > "... public health and the movement of people and goods, and other  
> > factors ..."
> > 
> > Above document is present in the search results but highlights are  
> > missing instead if I reverse search terms as mentioned below.
> > 
> > Query:
> > 
> > "query": {"text": {"raw\_content": {"query": "people good", "type":  
> > "phrase", "slop": 3}}}
> > 
> > Now, I have document with highlights present.
> > 
> > It seems order of words in multi-words query is important in case of  
> > slop but search is working perfectly either ways only highlights are  
> > failing.
> > 
> > Pardon me if I am missing some basic stuff and do consider if its a  
> > genuine issue.

---

<div class="post-metadata">

**Author:** ![Robert\_2](https://avatars.discourse-cdn.com/v4/letter/r/7ea924/32.png) [@Robert\_2](https://discuss.elastic.co/u/Robert_2)\
**Post date:** [May 24, 2012, 8:40pm UTC](https://discuss.elastic.co/t/highlight-missing-for-multi-word-text-phrase-query-with-non-zero-slop/6765/4 "2012-05-24T20:40:13Z")

</div>

This ends up being an issue just with the fast vector highlighter, the  
plain highlighter returns highlighted content no matter the order of the  
proximity query.

Not sure if there is any way to make this work with fast vector  
highlighting?

On Thursday, May 24, 2012 12:35:54 PM UTC-4, Robert wrote:

> I am seeing this same issue as well, where a proximity search in a  
> query\_string matches (order doesn't matter) yet the fast vector highlighter  
> returns no highlighted content (unless in correct order).
> 
> Any updates on this issue?
> 
> On Tuesday, February 21, 2012 4:02:44 AM UTC-5, Raj wrote:
> 
> > A Small Update:
> > 
> > Tested scenario with span\_near query with in\_order:false. Still  
> > highlights are missing.
> > 
> > Query:  
> > "query": {"span\_near": {"in\_order": false, "clauses": [{"span\_term":  
> > {"raw\_content": "good"}}, {"span\_term": {"raw\_content": "people"}}],  
> > "slop": 3}}
> > 
> > On Feb 21, 1:21 pm, Raj [rajdeepn...@gmail.com](mailto:rajdeepn...@gmail.com) wrote:
> > 
> > > Just noticed a weird issue where highlight for a few search results  
> > > are missing in case of text phrase query with slop 3(in my case) for a  
> > > multi-word query(where order of words in query is not same as in  
> > > document).
> > > 
> > > E.g.  
> > > Tested on Versions - 0.18.6/0.18.7
> > > 
> > > Mapping for field:
> > > 
> > > "raw\_content":{  
> > > "index\_analyzer":"snowball",  
> > > "search\_analyzer":"snowball",  
> > > "boost":0.5,  
> > > "index": "analyzed",  
> > > "store": "yes",  
> > > "type": u"string",  
> > > "term\_vector" : "with\_positions\_offsets"},
> > > 
> > > Query:
> > > 
> > > "query": {"text": {"raw\_content": {"query": "good people", "type":  
> > > "phrase", "slop": 3}}}
> > > 
> > > Actual text in raw\_content field:
> > > 
> > > "... public health and the movement of people and goods, and other  
> > > factors ..."
> > > 
> > > Above document is present in the search results but highlights are  
> > > missing instead if I reverse search terms as mentioned below.
> > > 
> > > Query:
> > > 
> > > "query": {"text": {"raw\_content": {"query": "people good", "type":  
> > > "phrase", "slop": 3}}}
> > > 
> > > Now, I have document with highlights present.
> > > 
> > > It seems order of words in multi-words query is important in case of  
> > > slop but search is working perfectly either ways only highlights are  
> > > failing.
> > > 
> > > Pardon me if I am missing some basic stuff and do consider if its a  
> > > genuine issue.
> 
> On Tuesday, February 21, 2012 4:02:44 AM UTC-5, Raj wrote:
> 
> > A Small Update:
> > 
> > Tested scenario with span\_near query with in\_order:false. Still  
> > highlights are missing.
> > 
> > Query:  
> > "query": {"span\_near": {"in\_order": false, "clauses": [{"span\_term":  
> > {"raw\_content": "good"}}, {"span\_term": {"raw\_content": "people"}}],  
> > "slop": 3}}
> > 
> > On Feb 21, 1:21 pm, Raj [rajdeepn...@gmail.com](mailto:rajdeepn...@gmail.com) wrote:
> > 
> > > Just noticed a weird issue where highlight for a few search results  
> > > are missing in case of text phrase query with slop 3(in my case) for a  
> > > multi-word query(where order of words in query is not same as in  
> > > document).
> > > 
> > > E.g.  
> > > Tested on Versions - 0.18.6/0.18.7
> > > 
> > > Mapping for field:
> > > 
> > > "raw\_content":{  
> > > "index\_analyzer":"snowball",  
> > > "search\_analyzer":"snowball",  
> > > "boost":0.5,  
> > > "index": "analyzed",  
> > > "store": "yes",  
> > > "type": u"string",  
> > > "term\_vector" : "with\_positions\_offsets"},
> > > 
> > > Query:
> > > 
> > > "query": {"text": {"raw\_content": {"query": "good people", "type":  
> > > "phrase", "slop": 3}}}
> > > 
> > > Actual text in raw\_content field:
> > > 
> > > "... public health and the movement of people and goods, and other  
> > > factors ..."
> > > 
> > > Above document is present in the search results but highlights are  
> > > missing instead if I reverse search terms as mentioned below.
> > > 
> > > Query:
> > > 
> > > "query": {"text": {"raw\_content": {"query": "people good", "type":  
> > > "phrase", "slop": 3}}}
> > > 
> > > Now, I have document with highlights present.
> > > 
> > > It seems order of words in multi-words query is important in case of  
> > > slop but search is working perfectly either ways only highlights are  
> > > failing.
> > > 
> > > Pardon me if I am missing some basic stuff and do consider if its a  
> > > genuine issue.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [May 29, 2012, 6:20pm UTC](https://discuss.elastic.co/t/highlight-missing-for-multi-word-text-phrase-query-with-non-zero-slop/6765/5 "2012-05-29T18:20:12Z")

</div>

Which version are you using? Can you try with latest ES 0.19.4?

On Thu, May 24, 2012 at 10:40 PM, Robert [rjabbott82@gmail.com](mailto:rjabbott82@gmail.com) wrote:

> This ends up being an issue just with the fast vector highlighter, the  
> plain highlighter returns highlighted content no matter the order of the  
> proximity query.
> 
> Not sure if there is any way to make this work with fast vector  
> highlighting?
> 
> On Thursday, May 24, 2012 12:35:54 PM UTC-4, Robert wrote:
> 
> > I am seeing this same issue as well, where a proximity search in a  
> > query\_string matches (order doesn't matter) yet the fast vector highlighter  
> > returns no highlighted content (unless in correct order).
> > 
> > Any updates on this issue?
> > 
> > On Tuesday, February 21, 2012 4:02:44 AM UTC-5, Raj wrote:
> > 
> > > A Small Update:
> > > 
> > > Tested scenario with span\_near query with in\_order:false. Still  
> > > highlights are missing.
> > > 
> > > Query:  
> > > "query": {"span\_near": {"in\_order": false, "clauses": [{"span\_term":  
> > > {"raw\_content": "good"}}, {"span\_term": {"raw\_content": "people"}}],  
> > > "slop": 3}}
> > > 
> > > On Feb 21, 1:21 pm, Raj [rajdeepn...@gmail.com](mailto:rajdeepn...@gmail.com) wrote:
> > > 
> > > > Just noticed a weird issue where highlight for a few search results  
> > > > are missing in case of text phrase query with slop 3(in my case) for a  
> > > > multi-word query(where order of words in query is not same as in  
> > > > document).
> > > > 
> > > > E.g.  
> > > > Tested on Versions - 0.18.6/0.18.7
> > > > 
> > > > Mapping for field:
> > > > 
> > > > "raw\_content":{  
> > > > "index\_analyzer":"snowball",  
> > > > "search\_analyzer":"snowball",  
> > > > "boost":0.5,  
> > > > "index": "analyzed",  
> > > > "store": "yes",  
> > > > "type": u"string",  
> > > > "term\_vector" : "with\_positions\_offsets"},
> > > > 
> > > > Query:
> > > > 
> > > > "query": {"text": {"raw\_content": {"query": "good people", "type":  
> > > > "phrase", "slop": 3}}}
> > > > 
> > > > Actual text in raw\_content field:
> > > > 
> > > > "... public health and the movement of people and goods, and other  
> > > > factors ..."
> > > > 
> > > > Above document is present in the search results but highlights are  
> > > > missing instead if I reverse search terms as mentioned below.
> > > > 
> > > > Query:
> > > > 
> > > > "query": {"text": {"raw\_content": {"query": "people good", "type":  
> > > > "phrase", "slop": 3}}}
> > > > 
> > > > Now, I have document with highlights present.
> > > > 
> > > > It seems order of words in multi-words query is important in case of  
> > > > slop but search is working perfectly either ways only highlights are  
> > > > failing.
> > > > 
> > > > Pardon me if I am missing some basic stuff and do consider if its a  
> > > > genuine issue.
> > 
> > On Tuesday, February 21, 2012 4:02:44 AM UTC-5, Raj wrote:
> > 
> > > A Small Update:
> > > 
> > > Tested scenario with span\_near query with in\_order:false. Still  
> > > highlights are missing.
> > > 
> > > Query:  
> > > "query": {"span\_near": {"in\_order": false, "clauses": [{"span\_term":  
> > > {"raw\_content": "good"}}, {"span\_term": {"raw\_content": "people"}}],  
> > > "slop": 3}}
> > > 
> > > On Feb 21, 1:21 pm, Raj [rajdeepn...@gmail.com](mailto:rajdeepn...@gmail.com) wrote:
> > > 
> > > > Just noticed a weird issue where highlight for a few search results  
> > > > are missing in case of text phrase query with slop 3(in my case) for a  
> > > > multi-word query(where order of words in query is not same as in  
> > > > document).
> > > > 
> > > > E.g.  
> > > > Tested on Versions - 0.18.6/0.18.7
> > > > 
> > > > Mapping for field:
> > > > 
> > > > "raw\_content":{  
> > > > "index\_analyzer":"snowball",  
> > > > "search\_analyzer":"snowball",  
> > > > "boost":0.5,  
> > > > "index": "analyzed",  
> > > > "store": "yes",  
> > > > "type": u"string",  
> > > > "term\_vector" : "with\_positions\_offsets"},
> > > > 
> > > > Query:
> > > > 
> > > > "query": {"text": {"raw\_content": {"query": "good people", "type":  
> > > > "phrase", "slop": 3}}}
> > > > 
> > > > Actual text in raw\_content field:
> > > > 
> > > > "... public health and the movement of people and goods, and other  
> > > > factors ..."
> > > > 
> > > > Above document is present in the search results but highlights are  
> > > > missing instead if I reverse search terms as mentioned below.
> > > > 
> > > > Query:
> > > > 
> > > > "query": {"text": {"raw\_content": {"query": "people good", "type":  
> > > > "phrase", "slop": 3}}}
> > > > 
> > > > Now, I have document with highlights present.
> > > > 
> > > > It seems order of words in multi-words query is important in case of  
> > > > slop but search is working perfectly either ways only highlights are  
> > > > failing.
> > > > 
> > > > Pardon me if I am missing some basic stuff and do consider if its a  
> > > > genuine issue.

---

<div class="post-metadata">

**Author:** ![Robert\_2](https://avatars.discourse-cdn.com/v4/letter/r/7ea924/32.png) [@Robert\_2](https://discuss.elastic.co/u/Robert_2)\
**Post date:** [May 29, 2012, 9:04pm UTC](https://discuss.elastic.co/t/highlight-missing-for-multi-word-text-phrase-query-with-non-zero-slop/6765/6 "2012-05-29T21:04:10Z")

</div>

Originally was using 0.19.2, but also tried (and failed) with 0.19.4

I believe this is the same issue as  
[Redirecting to Google Groups](https://groups.google.com/forum/#!starred/elasticsearch/d35-QiElg90) , which  
Issue [Proximity and phrases search fast-vector-highlighter vs. highlighter + exposing highlighter · Issue #1986 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1986) was opened  
for.

On Tuesday, May 29, 2012 2:20:12 PM UTC-4, kimchy wrote:

> Which version are you using? Can you try with latest ES 0.19.4?
> 
> On Thu, May 24, 2012 at 10:40 PM, Robert [rjabbott82@gmail.com](mailto:rjabbott82@gmail.com) wrote:
> 
> > This ends up being an issue just with the fast vector highlighter, the  
> > plain highlighter returns highlighted content no matter the order of the  
> > proximity query.
> > 
> > Not sure if there is any way to make this work with fast vector  
> > highlighting?
> > 
> > On Thursday, May 24, 2012 12:35:54 PM UTC-4, Robert wrote:
> > 
> > > I am seeing this same issue as well, where a proximity search in a  
> > > query\_string matches (order doesn't matter) yet the fast vector highlighter  
> > > returns no highlighted content (unless in correct order).
> > > 
> > > Any updates on this issue?
> > > 
> > > On Tuesday, February 21, 2012 4:02:44 AM UTC-5, Raj wrote:
> > > 
> > > > A Small Update:
> > > > 
> > > > Tested scenario with span\_near query with in\_order:false. Still  
> > > > highlights are missing.
> > > > 
> > > > Query:  
> > > > "query": {"span\_near": {"in\_order": false, "clauses": [{"span\_term":  
> > > > {"raw\_content": "good"}}, {"span\_term": {"raw\_content": "people"}}],  
> > > > "slop": 3}}
> > > > 
> > > > On Feb 21, 1:21 pm, Raj [rajdeepn...@gmail.com](mailto:rajdeepn...@gmail.com) wrote:
> > > > 
> > > > > Just noticed a weird issue where highlight for a few search results  
> > > > > are missing in case of text phrase query with slop 3(in my case) for  
> > > > > a  
> > > > > multi-word query(where order of words in query is not same as in  
> > > > > document).
> > > > > 
> > > > > E.g.  
> > > > > Tested on Versions - 0.18.6/0.18.7
> > > > > 
> > > > > Mapping for field:
> > > > > 
> > > > > "raw\_content":{  
> > > > > "index\_analyzer":"snowball",  
> > > > > "search\_analyzer":"snowball",  
> > > > > "boost":0.5,  
> > > > > "index": "analyzed",  
> > > > > "store": "yes",  
> > > > > "type": u"string",  
> > > > > "term\_vector" : "with\_positions\_offsets"},
> > > > > 
> > > > > Query:
> > > > > 
> > > > > "query": {"text": {"raw\_content": {"query": "good people", "type":  
> > > > > "phrase", "slop": 3}}}
> > > > > 
> > > > > Actual text in raw\_content field:
> > > > > 
> > > > > "... public health and the movement of people and goods, and other  
> > > > > factors ..."
> > > > > 
> > > > > Above document is present in the search results but highlights are  
> > > > > missing instead if I reverse search terms as mentioned below.
> > > > > 
> > > > > Query:
> > > > > 
> > > > > "query": {"text": {"raw\_content": {"query": "people good", "type":  
> > > > > "phrase", "slop": 3}}}
> > > > > 
> > > > > Now, I have document with highlights present.
> > > > > 
> > > > > It seems order of words in multi-words query is important in case of  
> > > > > slop but search is working perfectly either ways only highlights are  
> > > > > failing.
> > > > > 
> > > > > Pardon me if I am missing some basic stuff and do consider if its a  
> > > > > genuine issue.
> > > 
> > > On Tuesday, February 21, 2012 4:02:44 AM UTC-5, Raj wrote:
> > > 
> > > > A Small Update:
> > > > 
> > > > Tested scenario with span\_near query with in\_order:false. Still  
> > > > highlights are missing.
> > > > 
> > > > Query:  
> > > > "query": {"span\_near": {"in\_order": false, "clauses": [{"span\_term":  
> > > > {"raw\_content": "good"}}, {"span\_term": {"raw\_content": "people"}}],  
> > > > "slop": 3}}
> > > > 
> > > > On Feb 21, 1:21 pm, Raj [rajdeepn...@gmail.com](mailto:rajdeepn...@gmail.com) wrote:
> > > > 
> > > > > Just noticed a weird issue where highlight for a few search results  
> > > > > are missing in case of text phrase query with slop 3(in my case) for  
> > > > > a  
> > > > > multi-word query(where order of words in query is not same as in  
> > > > > document).
> > > > > 
> > > > > E.g.  
> > > > > Tested on Versions - 0.18.6/0.18.7
> > > > > 
> > > > > Mapping for field:
> > > > > 
> > > > > "raw\_content":{  
> > > > > "index\_analyzer":"snowball",  
> > > > > "search\_analyzer":"snowball",  
> > > > > "boost":0.5,  
> > > > > "index": "analyzed",  
> > > > > "store": "yes",  
> > > > > "type": u"string",  
> > > > > "term\_vector" : "with\_positions\_offsets"},
> > > > > 
> > > > > Query:
> > > > > 
> > > > > "query": {"text": {"raw\_content": {"query": "good people", "type":  
> > > > > "phrase", "slop": 3}}}
> > > > > 
> > > > > Actual text in raw\_content field:
> > > > > 
> > > > > "... public health and the movement of people and goods, and other  
> > > > > factors ..."
> > > > > 
> > > > > Above document is present in the search results but highlights are  
> > > > > missing instead if I reverse search terms as mentioned below.
> > > > > 
> > > > > Query:
> > > > > 
> > > > > "query": {"text": {"raw\_content": {"query": "people good", "type":  
> > > > > "phrase", "slop": 3}}}
> > > > > 
> > > > > Now, I have document with highlights present.
> > > > > 
> > > > > It seems order of words in multi-words query is important in case of  
> > > > > slop but search is working perfectly either ways only highlights are  
> > > > > failing.
> > > > > 
> > > > > Pardon me if I am missing some basic stuff and do consider if its a  
> > > > > genuine issue.

---

<div class="post-metadata">

**Author:** ![Sagar\_Mehta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sagar_mehta/32/2138_2.png) [@Sagar\_Mehta](https://discuss.elastic.co/u/Sagar_Mehta)\
**Post date:** [July 16, 2012, 1:18am UTC](https://discuss.elastic.co/t/highlight-missing-for-multi-word-text-phrase-query-with-non-zero-slop/6765/7 "2012-07-16T01:18:29Z")

</div>

Is the only way around this currently (assuming we want to highlight  
results in the phrase query even if they appear out of order) to turn  
off the fast-vector highlighting for a field by setting not setting  
"term\_vector" : "with\_positions\_offsets" in our mapping?

On May 29, 2:04 pm, Robert [rjabbot...@gmail.com](mailto:rjabbot...@gmail.com) wrote:

> Originally was using 0.19.2, but also tried (and failed) with 0.19.4
> 
> I believe this is the same issue as [Redirecting to Google Groups](https://groups.google.com/forum/#!starred/elasticsearch/d35-QiElg90), which  
> Issuehttps://github.com/elasticsearch/elasticsearch/issues/1986was opened  
> for.
> 
> On Tuesday, May 29, 2012 2:20:12 PM UTC-4, kimchy wrote:
> 
> > Which version are you using? Can you try with latest ES 0.19.4?
> 
> > On Thu, May 24, 2012 at 10:40 PM, Robert [rjabbot...@gmail.com](mailto:rjabbot...@gmail.com) wrote:
> 
> > > This ends up being an issue just with the fast vector highlighter, the  
> > > plain highlighter returns highlighted content no matter the order of the  
> > > proximity query.
> 
> > > Not sure if there is any way to make this work with fast vector  
> > > highlighting?
> 
> > > On Thursday, May 24, 2012 12:35:54 PM UTC-4, Robert wrote:
> 
> > > > I am seeing this same issue as well, where a proximity search in a  
> > > > query\_string matches (order doesn't matter) yet the fast vector highlighter  
> > > > returns no highlighted content (unless in correct order).
> 
> > > > Any updates on this issue?
> 
> > > > On Tuesday, February 21, 2012 4:02:44 AM UTC-5, Raj wrote:
> 
> > > > > A Small Update:
> 
> > > > > Tested scenario with span\_near query with in\_order:false. Still  
> > > > > highlights are missing.
> 
> > > > > Query:  
> > > > > "query": {"span\_near": {"in\_order": false, "clauses": [{"span\_term":  
> > > > > {"raw\_content": "good"}}, {"span\_term": {"raw\_content": "people"}}],  
> > > > > "slop": 3}}
> 
> > > > > On Feb 21, 1:21 pm, Raj [rajdeepn...@gmail.com](mailto:rajdeepn...@gmail.com) wrote:
> > > > > 
> > > > > > Just noticed a weird issue where highlight for a few search results  
> > > > > > are missing in case of text phrase query with slop 3(in my case) for  
> > > > > > a  
> > > > > > multi-word query(where order of words in query is not same as in  
> > > > > > document).
> 
> > > > > > E.g.  
> > > > > > Tested on Versions - 0.18.6/0.18.7
> 
> > > > > > Mapping for field:
> 
> > > > > > "raw\_content":{  
> > > > > > "index\_analyzer":"snowball",  
> > > > > > "search\_analyzer":"snowball",  
> > > > > > "boost":0.5,  
> > > > > > "index": "analyzed",  
> > > > > > "store": "yes",  
> > > > > > "type": u"string",  
> > > > > > "term\_vector" : "with\_positions\_offsets"},
> 
> > > > > > Query:
> 
> > > > > > "query": {"text": {"raw\_content": {"query": "good people", "type":  
> > > > > > "phrase", "slop": 3}}}
> 
> > > > > > Actual text in raw\_content field:
> 
> > > > > > "... public health and the movement of people and goods, and other  
> > > > > > factors ..."
> 
> > > > > > Above document is present in the search results but highlights are  
> > > > > > missing instead if I reverse search terms as mentioned below.
> 
> > > > > > Query:
> 
> > > > > > "query": {"text": {"raw\_content": {"query": "people good", "type":  
> > > > > > "phrase", "slop": 3}}}
> 
> > > > > > Now, I have document with highlights present.
> 
> > > > > > It seems order of words in multi-words query is important in case of  
> > > > > > slop but search is working perfectly either ways only highlights are  
> > > > > > failing.
> 
> > > > > > Pardon me if I am missing some basic stuff and do consider if its a  
> > > > > > genuine issue.
> 
> > > > On Tuesday, February 21, 2012 4:02:44 AM UTC-5, Raj wrote:
> 
> > > > > A Small Update:
> 
> > > > > Tested scenario with span\_near query with in\_order:false. Still  
> > > > > highlights are missing.
> 
> > > > > Query:  
> > > > > "query": {"span\_near": {"in\_order": false, "clauses": [{"span\_term":  
> > > > > {"raw\_content": "good"}}, {"span\_term": {"raw\_content": "people"}}],  
> > > > > "slop": 3}}
> 
> > > > > On Feb 21, 1:21 pm, Raj [rajdeepn...@gmail.com](mailto:rajdeepn...@gmail.com) wrote:
> > > > > 
> > > > > > Just noticed a weird issue where highlight for a few search results  
> > > > > > are missing in case of text phrase query with slop 3(in my case) for  
> > > > > > a  
> > > > > > multi-word query(where order of words in query is not same as in  
> > > > > > document).
> 
> > > > > > E.g.  
> > > > > > Tested on Versions - 0.18.6/0.18.7
> 
> > > > > > Mapping for field:
> 
> > > > > > "raw\_content":{  
> > > > > > "index\_analyzer":"snowball",  
> > > > > > "search\_analyzer":"snowball",  
> > > > > > "boost":0.5,  
> > > > > > "index": "analyzed",  
> > > > > > "store": "yes",  
> > > > > > "type": u"string",  
> > > > > > "term\_vector" : "with\_positions\_offsets"},
> 
> > > > > > Query:
> 
> > > > > > "query": {"text": {"raw\_content": {"query": "good people", "type":  
> > > > > > "phrase", "slop": 3}}}
> 
> > > > > > Actual text in raw\_content field:
> 
> > > > > > "... public health and the movement of people and goods, and other  
> > > > > > factors ..."
> 
> > > > > > Above document is present in the search results but highlights are  
> > > > > > missing instead if I reverse search terms as mentioned below.
> 
> > > > > > Query:
> 
> > > > > > "query": {"text": {"raw\_content": {"query": "people good", "type":  
> > > > > > "phrase", "slop": 3}}}
> 
> > > > > > Now, I have document with highlights present.
> 
> > > > > > It seems order of words in multi-words query is important in case of  
> > > > > > slop but search is working perfectly either ways only highlights are  
> > > > > > failing.
> 
> > > > > > Pardon me if I am missing some basic stuff and do consider if its a  
> > > > > > genuine issue.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:20am UTC](https://discuss.elastic.co/t/highlight-missing-for-multi-word-text-phrase-query-with-non-zero-slop/6765/8 "2017-07-06T03:20:14Z")

</div>


