# Possible issue with ngrams and highlighting? Gist included. (Was: Which is the best (right) use of NGrams?)

**URL:** <https://discuss.elastic.co/t/possible-issue-with-ngrams-and-highlighting-gist-included-was-which-is-the-best-right-use-of-ngrams/10842>\
**Category:** Elasticsearch\
**Created:** [February 21, 2013, 3:32pm UTC](https://discuss.elastic.co/t/possible-issue-with-ngrams-and-highlighting-gist-included-was-which-is-the-best-right-use-of-ngrams/10842 "2013-02-21T15:32:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [February 21, 2013, 3:32pm UTC](https://discuss.elastic.co/t/possible-issue-with-ngrams-and-highlighting-gist-included-was-which-is-the-best-right-use-of-ngrams/10842/1 "2013-02-21T15:32:09Z")

</div>

Hi Alex,

I created a gist with my experiments:

> <https://gist.github.com/lukas-vlcek/5005428>

The last technique (using query\_string with whitespace analyser) does not  
seem to work consistently. Is this a bug or I am doing it wrong? Shall I  
open a ticket for this?

Regards,  
Lukas

On Thu, Feb 21, 2013 at 5:49 AM, AlexR [roytmana@gmail.com](mailto:roytmana@gmail.com) wrote:

> Hi Lukas,
> 
> It will be very interesting to compare notes. I will be out of town for  
> few days and may not be able to conclude my test so lets touch base next  
> week if it's ok with you
> 
> Alex
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [February 21, 2013, 3:56pm UTC](https://discuss.elastic.co/t/possible-issue-with-ngrams-and-highlighting-gist-included-was-which-is-the-best-right-use-of-ngrams/10842/2 "2013-02-21T15:56:00Z")

</div>

On Thu, 2013-02-21 at 16:32 +0100, Lukáš Vlček wrote:

> Hi Alex,
> 
> I created a gist with my experiments:  
> [Elasticsearch: Highlighting with nGrams (possible issue?) · GitHub](https://gist.github.com/lukas-vlcek/5005428)
> 
> The last technique (using query\_string with whitespace analyser) does  
> not seem to work consistently. Is this a bug or I am doing it wrong?  
> Shall I open a ticket for this?

It seems to be related to your use of the keyword tokenizer.

When using the standard tokenizer, it works:

> <https://gist.github.com/clintongormley/5005666>

clint

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [February 21, 2013, 4:34pm UTC](https://discuss.elastic.co/t/possible-issue-with-ngrams-and-highlighting-gist-included-was-which-is-the-best-right-use-of-ngrams/10842/3 "2013-02-21T16:34:40Z")

</div>

This seems to be working better!  
Thanks Clint.

On Thu, Feb 21, 2013 at 4:56 PM, Clinton Gormley [clint@traveljury.com](mailto:clint@traveljury.com)wrote:

> On Thu, 2013-02-21 at 16:32 +0100, Lukáš Vlček wrote:
> 
> > Hi Alex,
> > 
> > I created a gist with my experiments:  
> > [Elasticsearch: Highlighting with nGrams (possible issue?) · GitHub](https://gist.github.com/lukas-vlcek/5005428)
> > 
> > The last technique (using query\_string with whitespace analyser) does  
> > not seem to work consistently. Is this a bug or I am doing it wrong?  
> > Shall I open a ticket for this?
> 
> It seems to be related to your use of the keyword tokenizer.
> 
> When using the standard tokenizer, it works:
> 
> [gist:5005666 · GitHub](https://gist.github.com/clintongormley/5005666)
> 
> clint
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:50am UTC](https://discuss.elastic.co/t/possible-issue-with-ngrams-and-highlighting-gist-included-was-which-is-the-best-right-use-of-ngrams/10842/4 "2017-07-06T02:50:15Z")

</div>


