# Analyze two-words phrase as one token

**URL:** <https://discuss.elastic.co/t/analyze-two-words-phrase-as-one-token/294305>\
**Category:** Elasticsearch\
**Created:** [January 13, 2022, 4:46pm UTC](https://discuss.elastic.co/t/analyze-two-words-phrase-as-one-token/294305 "2022-01-13T16:46:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Talya](https://avatars.discourse-cdn.com/v4/letter/t/d9b06d/32.png) [@Talya](https://discuss.elastic.co/u/Talya)\
**Post date:** [January 13, 2022, 4:46pm UTC](https://discuss.elastic.co/t/analyze-two-words-phrase-as-one-token/294305/1 "2022-01-13T16:46:10Z")

</div>

When dealing with phrases consisting with two words, I want to index them as one token and not retrieve them when the search matching one of those words. For ex. I have document with "French Toast", when someone is searching for "Toast with cheese" or "french crepe" I don't want the "french toast" to be retrieved as it's not relevant. any ideas?  
Thanks

---

<div class="post-metadata">

**Author:** ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)\
**Post date:** [January 13, 2022, 5:08pm UTC](https://discuss.elastic.co/t/analyze-two-words-phrase-as-one-token/294305/2 "2022-01-13T17:08:32Z")

</div>

Why not use wildcard field and wildcard query?

---

<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:** [January 13, 2022, 6:16pm UTC](https://discuss.elastic.co/t/analyze-two-words-phrase-as-one-token/294305/3 "2022-01-13T18:16:33Z")

</div>

Hi Talya.  
Sounds like you want to index using [shingles](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-shingle-tokenfilter.html)

---

<div class="post-metadata">

**Author:** ![Talya](https://avatars.discourse-cdn.com/v4/letter/t/d9b06d/32.png) [@Talya](https://discuss.elastic.co/u/Talya)\
**Post date:** [January 14, 2022, 1:26pm UTC](https://discuss.elastic.co/t/analyze-two-words-phrase-as-one-token/294305/4 "2022-01-14T13:26:13Z")

</div>

I can't change the query, just the analyzer..

---

<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:** [January 16, 2022, 8:59am UTC](https://discuss.elastic.co/t/analyze-two-words-phrase-as-one-token/294305/5 "2022-01-16T08:59:04Z")

</div>

Analysers are used on both documents and queries so that they can match searches.

---

<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:** [February 13, 2022, 8:59am UTC](https://discuss.elastic.co/t/analyze-two-words-phrase-as-one-token/294305/6 "2022-02-13T08:59:48Z")

</div>

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