I am trying to get records using the Query String Query .
My scenario for searching is as follows :
I have to search like : "I Love my " AND (HTC OR Iphone OR Samsung)
And I am expecting result like :  
I just tried some combinations but its not working
{
  "query": {
            "query_string": {
                "default_field": "SearchContent",
               "query": "\"I Love my\" AND (HTC OR Iphone OR Samsung)"
            }
        }
}
How can i do this with Query String Or is there any Other Option , i am stuck. Help me out.
The query depends on your _mapping. If you haven't defined any, then probably the standard analyzer is used. If so then tokens are:
notice the tokens are lowercase.
The proper format for your query string is:
GET /yourindex/_search
{
  "query": {
    "query_string": {
      "default_field": "SearchContent",
      "query": "\"i love my\" AND (samsung OR htc OR iphone)"
    }
  }
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With