It's a "feature" of the query_string. What's happening is this query:

sofa OR rugs AND red

Actually means "rugs" and "red" must be there (always) to match. And if a 
document is a match (i.e. it contains both rugs and red) and it contains 
sofa also, then boost that document up some more ahead of the others.

This query:

sofa OR (rugs AND red)


Actually means either "sofa" is there, or ("rugs" and "red") is there to be a 
match. This is what you expect as normal boolean logic.


The easiest way to see and understand whats happening is to use the _validate 
API like this:


curl -XPOST "http://localhost:9200/f/_validate/query?explain&pretty"; -d '

{
  "query": {
    "query_string": {
      "query": "sofa OR rugs AND red",
      "default_operator": "AND"
    }
  }
}'


If you _validate/explain the other query, you will understand how it is 
"interpreted".

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/32f4de3a-4ee8-44a5-ad7e-e010adb334d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to