# Get matched keywords while searching on an analysed field

**URL:** <https://discuss.elastic.co/t/get-matched-keywords-while-searching-on-an-analysed-field/15029>\
**Category:** Elasticsearch\
**Created:** [December 27, 2013, 9:17am UTC](https://discuss.elastic.co/t/get-matched-keywords-while-searching-on-an-analysed-field/15029 "2013-12-27T09:17:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubyprince](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@rubyprince](https://discuss.elastic.co/u/rubyprince)\
**Post date:** [December 27, 2013, 9:17am UTC](https://discuss.elastic.co/t/get-matched-keywords-while-searching-on-an-analysed-field/15029/1 "2013-12-27T09:17:41Z")

</div>

Hi,

Can someone help me with this?

> <https://stackoverflow.com/questions/20780104/get-matched-keywords-while-searching-on-an-analysed-field>

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/c27269c2-4f20-441d-b124-5b40ac46bba0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c27269c2-4f20-441d-b124-5b40ac46bba0%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 27, 2013, 10:34am UTC](https://discuss.elastic.co/t/get-matched-keywords-while-searching-on-an-analysed-field/15029/2 "2013-12-27T10:34:26Z")

</div>

May be highlighting could help? [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-highlighting.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-highlighting.html)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 27 décembre 2013 at 10:17:46, Prince ([princejcet@gmail.com](mailto:princejcet@gmail.com)) a écrit:

Hi,

Can someone help me with this?

## [http://stackoverflow.com/questions/20780104/get-matched-terms-in-the-query](http://stackoverflow.com/questions/20780104/get-matched-terms-in-the-query)

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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/c27269c2-4f20-441d-b124-5b40ac46bba0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c27269c2-4f20-441d-b124-5b40ac46bba0%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/etPan.52bd57c6.333ab105.55aa%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.52bd57c6.333ab105.55aa%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [December 27, 2013, 2:50pm UTC](https://discuss.elastic.co/t/get-matched-keywords-while-searching-on-an-analysed-field/15029/3 "2013-12-27T14:50:55Z")

</div>

It would be possible to implement a "highlighter" that just returned which  
terms matched which fields but Elasticsearch doesn't have one now. I think  
you have two options at this point:

1. Do something hacky with highlighting like asking for the text length to  
be the max(all\_strings.map(strlen).max, min\_highlight\_length), strip the  
text that isn't highlighted, and dedupe.
2. Do two searches either via multisearch or sequentially.

On Fri, Dec 27, 2013 at 5:34 AM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> May be highlighting could help?  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-highlighting.html)
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> 
> Le 27 décembre 2013 at 10:17:46, Prince ([princejcet@gmail.com](mailto:princejcet@gmail.com)//princejcet@gmail.com)  
> a écrit:
> 
> Hi,
> 
> Can someone help me with this?
> 
> ## [elasticsearch - Get matched keywords while searching on an analysed field - Stack Overflow](http://stackoverflow.com/questions/20780104/get-matched-terms-in-the-query)
> 
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/c27269c2-4f20-441d-b124-5b40ac46bba0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c27269c2-4f20-441d-b124-5b40ac46bba0%40googlegroups.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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/etPan.52bd57c6.333ab105.55aa%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.52bd57c6.333ab105.55aa%40MacBook-Air-de-David.local)  
> .
> 
> 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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAPmjWd1CtGBrO3Fme1H8xGYwpMdYoR10SY2fp%2B3%2BTHDU8RCQyA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd1CtGBrO3Fme1H8xGYwpMdYoR10SY2fp%2B3%2BTHDU8RCQyA%40mail.gmail.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, 1:59am UTC](https://discuss.elastic.co/t/get-matched-keywords-while-searching-on-an-analysed-field/15029/4 "2017-07-06T01:59:16Z")

</div>


