Default_operator


(Sindre Sorhus) #1

I'm trying to set the default_operatorhttp://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html to
"AND", but it's ignoring my setting.

When I search for "john doe", I get results for "john mac" and "adam doe".

Any help?

My query: https://gist.github.com/1144451


(Jamshid) #2

Hmm I'm also seeing that with a json body query.

That surprised me because I rely on default_operator=AND and it works
for me, though I do a url query. E.g.:

curl -i 'http://localhost:9200/_search?
pretty=yes&default_operator=AND&lowercase_expanded_terms=false&q=myfield1:myvalue1%20myfield2:myvalue2*'

Does it work if you change to this style instead of a json body?

curl -i 'http://localhost:9200/_search?
pretty=yes&default_operator=AND&q=john%20doe'

--Jamshid

On Aug 13, 8:03 pm, Sindre Sorhus sindresor...@gmail.com wrote:

I'm trying to set the default_operatorhttp://www.elasticsearch.org/guide/reference/query-dsl/query-string-q... to
"AND", but it's ignoring my setting.

When I search for "john doe", I get results for "john mac" and "adam doe".

Any help?

My query:https://gist.github.com/1144451


(Shay Banon) #3

default_operator needs to be within the "query_string" element.

On Sun, Aug 14, 2011 at 4:03 AM, Sindre Sorhus sindresorhus@gmail.comwrote:

I'm trying to set the default_operatorhttp://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html to
"AND", but it's ignoring my setting.

When I search for "john doe", I get results for "john mac" and "adam doe".

Any help?

My query: https://gist.github.com/1144451


(Sindre Sorhus) #4

Duh, should have noticed that. Don't know what I was thinking. Sorry.


(system) #5