# Retrieve list of keyword variants using phonetic plugin

**URL:** <https://discuss.elastic.co/t/retrieve-list-of-keyword-variants-using-phonetic-plugin/146811>\
**Category:** Elasticsearch\
**Created:** [August 31, 2018, 6:37am UTC](https://discuss.elastic.co/t/retrieve-list-of-keyword-variants-using-phonetic-plugin/146811 "2018-08-31T06:37:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jan\_Chia](https://avatars.discourse-cdn.com/v4/letter/j/8491ac/32.png) [@Jan\_Chia](https://discuss.elastic.co/u/Jan_Chia)\
**Post date:** [August 31, 2018, 6:37am UTC](https://discuss.elastic.co/t/retrieve-list-of-keyword-variants-using-phonetic-plugin/146811/1 "2018-08-31T06:37:32Z")

</div>

Currently, the phonetic plugin performs full text search on the field and returns the whole content when a phonetically similar word is present in the content.

How do i return just that phonetically similar word instead of the whole content?

E.g. from ES documentation

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/7/f74c036631676b0e56352a3c4fe47d392448ebdc.png)

Querying for:  
GET /my\_index/my\_type/\_search  
{  
"query": {  
"match": {  
"name.phonetic": {  
"query": "Smeeth"  
}  
}  
}  
}

Would give me: John Smith, Johnnie Smythe  
But what I want is: Smith, Smythe

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [August 31, 2018, 9:23am UTC](https://discuss.elastic.co/t/retrieve-list-of-keyword-variants-using-phonetic-plugin/146811/2 "2018-08-31T09:23:19Z")

</div>

You could try use a `highlighter` and parse the result for the text between the `<em>...</em>` markup.

This would only work for a single-term search otherwise you'd have a hard time reverse engineering which search term was being highlighted with which tag.

---

<div class="post-metadata">

**Author:** ![Jan\_Chia](https://avatars.discourse-cdn.com/v4/letter/j/8491ac/32.png) [@Jan\_Chia](https://discuss.elastic.co/u/Jan_Chia)\
**Post date:** [September 3, 2018, 8:10am UTC](https://discuss.elastic.co/t/retrieve-list-of-keyword-variants-using-phonetic-plugin/146811/3 "2018-09-03T08:10:53Z")

</div>

Thank you Mark! Currently that is the way i would be going towards

---

<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:** [October 1, 2018, 8:10am UTC](https://discuss.elastic.co/t/retrieve-list-of-keyword-variants-using-phonetic-plugin/146811/4 "2018-10-01T08:10:57Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
