Exact Phrase Match on a not_analyzed field with a space in the phrase


(Edwin Frey) #1

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. 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.
For more options, visit https://groups.google.com/groups/opt_out.


(Nik Everett) #2

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 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: 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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.


(Edwin Frey) #3

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<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: 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 <javascript:>.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4