# Getting all words used in a document matching a stemmed query

**URL:** <https://discuss.elastic.co/t/getting-all-words-used-in-a-document-matching-a-stemmed-query/35159>\
**Category:** Elasticsearch\
**Created:** [November 20, 2015, 2:25pm UTC](https://discuss.elastic.co/t/getting-all-words-used-in-a-document-matching-a-stemmed-query/35159 "2015-11-20T14:25:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sspi](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@sspi](https://discuss.elastic.co/u/sspi)\
**Post date:** [November 20, 2015, 2:25pm UTC](https://discuss.elastic.co/t/getting-all-words-used-in-a-document-matching-a-stemmed-query/35159/1 "2015-11-20T14:25:42Z")

</div>

My scenario :

- partial full-text view is extracted from documents and sent to ES for indexing
- each document is viewable by final users in different html formats (these formats are not know by ES)

My need : To ask ES to get all words used in a document that match a stemmed query in order to highlight the terms in the viewable formats (by an external script).

Example : I need ES to return to me ["skies", "ski", "skiing"] when I ask it to get all derived words from "sky" that are present in full-text field in document \_id="1".

I have looked at "highlight" ([https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-highlighting.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-highlighting.html)) and "termvectors" ([https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html)) services, but none match exactly my needs.

Have I missed something ?  
If I need to implement my own service, do you think there is a preferred way ?

---

<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 5, 2017, 11:36pm UTC](https://discuss.elastic.co/t/getting-all-words-used-in-a-document-matching-a-stemmed-query/35159/2 "2017-07-05T23:36:53Z")

</div>


