How to search for “OR” word inside a Field on ElasticSearch?

I´m having a problem when I try to search into a field that stores the
states acronyms.

I have the next query:

{
"query": {
"query_string": {
"query": "field_state:'OR' AND type:incentive"
}
}
}

And the problem comes when i try to get the results for the Oregon State
(OR). For all the other states works but with this particular one is like
the Elasticsearch takes the "OR" as a condition an retrieves all.

Is there a way to make this work????, i have try it with terms, prefix
filters, and all with the same results.

--
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.

Try a should Bool Query:

http://www.elasticsearch.org/guide/reference/query-dsl/bool-query/

On Monday, June 17, 2013 8:41:04 PM UTC+1, Alfonso Noguez wrote:

I´m having a problem when I try to search into a field that stores the
states acronyms.

I have the next query:

{
"query": {
"query_string": {
"query": "field_state:'OR' AND type:incentive"
}
}
}

And the problem comes when i try to get the results for the Oregon State
(OR). For all the other states works but with this particular one is like
the Elasticsearch takes the "OR" as a condition an retrieves all.

Is there a way to make this work????, i have try it with terms, prefix
filters, and all with the same results.

--
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.

May be you need to escape the ''' with '' or '\\'