# Hyphens tokens duplicate terms!

**URL:** <https://discuss.elastic.co/t/hyphens-tokens-duplicate-terms/87038>\
**Category:** Elasticsearch\
**Created:** [May 24, 2017, 8:15pm UTC](https://discuss.elastic.co/t/hyphens-tokens-duplicate-terms/87038 "2017-05-24T20:15:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![klara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/klara/32/18440_2.png) [@klara](https://discuss.elastic.co/u/klara)\
**Post date:** [May 24, 2017, 8:15pm UTC](https://discuss.elastic.co/t/hyphens-tokens-duplicate-terms/87038/1 "2017-05-24T20:15:11Z")

</div>

Hi,  
I have two docs:

1. Word:"apple-apple "
2. Word:"apple-carrot"

And i want this way:  
1When i type: "apple-apple" see only apple-apple  
When i typing "apple" see both  
And when typing "apple carrot" see only apple-carrot  
Is it possible?  
I try wordelimitre indextime and get only  
'Apple-apple',apple,apple ,appleapple  
Apple-carrot,apple,carrot,applecarrot  
How i can here change hyphen to space?  
Just get apple-apple,apple apple,apple,apple)

---

<div class="post-metadata">

**Author:** ![klara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/klara/32/18440_2.png) [@klara](https://discuss.elastic.co/u/klara)\
**Post date:** [May 24, 2017, 8:28pm UTC](https://discuss.elastic.co/t/hyphens-tokens-duplicate-terms/87038/2 "2017-05-24T20:28:57Z")

</div>

Easy solution to have two analyzers for two fields, but i am not sure it will work like i want

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [May 24, 2017, 9:09pm UTC](https://discuss.elastic.co/t/hyphens-tokens-duplicate-terms/87038/3 "2017-05-24T21:09:05Z")

</div>

Did you look at the prefix query, if possible ?

[https://www.elastic.co/guide/en/elasticsearch/reference/5.4/query-dsl-prefix-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/query-dsl-prefix-query.html)

---

<div class="post-metadata">

**Author:** ![klara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/klara/32/18440_2.png) [@klara](https://discuss.elastic.co/u/klara)\
**Post date:** [May 24, 2017, 10:09pm UTC](https://discuss.elastic.co/t/hyphens-tokens-duplicate-terms/87038/4 "2017-05-24T22:09:17Z")

</div>

If i will use this query, then i must to know all of possible prefix , it is not possible(((  
any way thanks

---

<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:** [June 21, 2017, 10:09pm UTC](https://discuss.elastic.co/t/hyphens-tokens-duplicate-terms/87038/5 "2017-06-21T22:09:35Z")

</div>

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