# How to search an email

**URL:** <https://discuss.elastic.co/t/how-to-search-an-email/15729>\
**Category:** Elasticsearch\
**Created:** [February 11, 2014, 12:57pm UTC](https://discuss.elastic.co/t/how-to-search-an-email/15729 "2014-02-11T12:57:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tiago\_Rodrigues](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@Tiago\_Rodrigues](https://discuss.elastic.co/u/Tiago_Rodrigues)\
**Post date:** [February 11, 2014, 12:57pm UTC](https://discuss.elastic.co/t/how-to-search-an-email/15729/1 "2014-02-11T12:57:48Z")

</div>

Hello to all,

I need a query to search for an email. I tried using the query and match  
query term. But I did not get the results I expected.

For example, I tried to search for 'tiago@email.com', match query gives me  
the results that have 'tiago' ('tiago@hotmail.com', 'tiago@gmail.com') or  
have @email.com ('name@email.com', 'mark@email.com'). The query term does  
not give any results.

I ready for change the mapping, but i have a lot of docs, i think this is  
not the best option for me.

Thanks for any help and sory my poor english.

--  
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/f3432414-7f7f-4b02-99e5-e1a738caec66%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f3432414-7f7f-4b02-99e5-e1a738caec66%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:** ![Tiago\_Rodrigues](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@Tiago\_Rodrigues](https://discuss.elastic.co/u/Tiago_Rodrigues)\
**Post date:** [February 11, 2014, 1:19pm UTC](https://discuss.elastic.co/t/how-to-search-an-email/15729/2 "2014-02-11T13:19:31Z")

</div>

I have found the answer and i wish to share.

I just need to pass the 'type' : 'phrase' on match query or just use '

match\_phrase' 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/642290e3-f3a7-42ae-a9ce-01b570192ef6%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/642290e3-f3a7-42ae-a9ce-01b570192ef6%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:** ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)\
**Post date:** [February 11, 2014, 1:29pm UTC](https://discuss.elastic.co/t/how-to-search-an-email/15729/3 "2014-02-11T13:29:12Z")

</div>

Alternatively, if you want to preserve email address and web urls, you can  
use the uax\_url\_email tokenizer and then term and match queries should work  
without any problems.

--  
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/ef90a494-90b7-453a-a0e2-208aa34cc35e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ef90a494-90b7-453a-a0e2-208aa34cc35e%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:** ![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:51am UTC](https://discuss.elastic.co/t/how-to-search-an-email/15729/4 "2017-07-06T01:51:06Z")

</div>


