# Exact Phrase Match on a not\_analyzed field with a space in the phrase

**URL:** https://discuss.elastic.co/t/exact-phrase-match-on-a-not-analyzed-field-with-a-space-in-the-phrase/14251
**Category:** Elasticsearch
**Created:** [November 4, 2013, 9:51pm UTC](https://discuss.elastic.co/t/exact-phrase-match-on-a-not-analyzed-field-with-a-space-in-the-phrase/14251 "2013-11-04T21:51:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Edwin\_Frey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/edwin_frey/32/2006_2.png) [@Edwin\_Frey](https://discuss.elastic.co/u/Edwin_Frey)
#### Post date: [November 4, 2013, 9:51pm UTC](https://discuss.elastic.co/t/exact-phrase-match-on-a-not-analyzed-field-with-a-space-in-the-phrase/14251/1 "2013-11-04T21:51:07Z")

</div>

Good afternoon,  
I'm trying to boost a query that has an exact match on a field (in this  
case a name field). I've looked on Stack overflow and in this group and  
all of the answers seem to be set the field to not\_analyzed. I have done  
this; however, it doesn't return anything when I search for a proper name.  
It appears to affect anything with a space in it (I have a couple fields  
that I do a similar mapping on). I have created an example of what I am  
seeing here: [https://gist.github.com/edwinf/d422f0e66a0022173b44](https://gist.github.com/edwinf/d422f0e66a0022173b44). I know  
I'm probably doing something very simple wrong but cannot figure it out.  
Any advise would be appreciated!

Thank you  
-Ed

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)
#### Post date: [November 4, 2013, 10:05pm UTC](https://discuss.elastic.co/t/exact-phrase-match-on-a-not-analyzed-field-with-a-space-in-the-phrase/14251/2 "2013-11-04T22:05:43Z")

</div>

I think you need to decide exactly how exact "exact" is.

Is it character for character? That is not\_analyzed.  
Is it character for character modulo case? That is the keyword analyzer  
with a lower\_case token filter.  
Is it just the words that should match but any spaces? Can the words be in  
any order? That is a phrase query on a field analyzed without stemming.  
Is it ok if the words are conjugated differently so long as the words are  
close enough? That is a phrase query on a field analyzed with stemming.  
Is it that all the words should be there but you don't care how close they  
are? That is a query with the operator set to AND.

On Mon, Nov 4, 2013 at 4:51 PM, Edwin Frey [crazyoatmeal@gmail.com](mailto:crazyoatmeal@gmail.com) wrote:

> Good afternoon,  
> I'm trying to boost a query that has an exact match on a field (in  
> this case a name field). I've looked on Stack overflow and in this group  
> and all of the answers seem to be set the field to not\_analyzed. I have  
> done this; however, it doesn't return anything when I search for a proper  
> name. It appears to affect anything with a space in it (I have a couple  
> fields that I do a similar mapping on). I have created an example of what  
> I am seeing here: [Not Analyzed field not returning exact match. I'm doing something wrong. · GitHub](https://gist.github.com/edwinf/d422f0e66a0022173b44). I  
> know I'm probably doing something very simple wrong but cannot figure it  
> out. Any advise would be appreciated!
> 
> Thank you  
> -Ed
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Edwin\_Frey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/edwin_frey/32/2006_2.png) [@Edwin\_Frey](https://discuss.elastic.co/u/Edwin_Frey)
#### Post date: [November 5, 2013, 3:31am UTC](https://discuss.elastic.co/t/exact-phrase-match-on-a-not-analyzed-field-with-a-space-in-the-phrase/14251/3 "2013-11-05T03:31:02Z")

</div>

From your list, not\_analyzed is what we want (although I could also  
convince them that keyword is just as good). I'm just confused as to why a  
query search isn't returning any data when I have what should be an exact  
match on the not\_analyzed field.

On Monday, November 4, 2013 5:05:43 PM UTC-5, Nikolas Everett wrote:

> I think you need to decide exactly how exact "exact" is.
> 
> Is it character for character? That is not\_analyzed.  
> Is it character for character modulo case? That is the keyword analyzer  
> with a lower\_case token filter.  
> Is it just the words that should match but any spaces? Can the words be  
> in any order? That is a phrase query on a field analyzed without stemming.  
> Is it ok if the words are conjugated differently so long as the words are  
> close enough? That is a phrase query on a field analyzed with stemming.  
> Is it that all the words should be there but you don't care how close they  
> are? That is a query with the operator set to AND.
> 
> On Mon, Nov 4, 2013 at 4:51 PM, Edwin Frey \<[crazyo...@gmail.com](mailto:crazyo...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Good afternoon,  
> > I'm trying to boost a query that has an exact match on a field (in  
> > this case a name field). I've looked on Stack overflow and in this group  
> > and all of the answers seem to be set the field to not\_analyzed. I have  
> > done this; however, it doesn't return anything when I search for a proper  
> > name. It appears to affect anything with a space in it (I have a couple  
> > fields that I do a similar mapping on). I have created an example of what  
> > I am seeing here: [Not Analyzed field not returning exact match. I'm doing something wrong. · GitHub](https://gist.github.com/edwinf/d422f0e66a0022173b44).  
> > I know I'm probably doing something very simple wrong but cannot figure it  
> > out. Any advise would be appreciated!
> > 
> > Thank you  
> > -Ed
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
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, 2:08am UTC](https://discuss.elastic.co/t/exact-phrase-match-on-a-not-analyzed-field-with-a-space-in-the-phrase/14251/4 "2017-07-06T02:08:56Z")

</div>


