1

ElasticSearch returns me "query_parsing_exception","reason":"[bool] query does not support " error when trying to look up entries using the following query.i think the problem is about "query_string"

curl -XGET '<myurl>:<myport>/index/_search?pretty' -d '
{
  "query": {
     "bool": {
        "must":[ {
           "term" : {
              "query" : "1.2.3.4",
              "fields" : [ "ip" ]
                    }
                },{
              "range" : {
               "localtime" : {
                   "from" : "2016-06-15T06:00:04.923Z",
                    "to" : "2016-06-17T17:43:04.923Z",
                     "include_lower" : true,
                     "include_upper" : true
                               }
                       }
               },
          "query_string" : {
          "default_field" : "_all",
          "query" : "word1 OR word1",

          } ]
       }
   }
 }'

Why does this error appear?

Thanks


anyhelp will be appreciated ! thanks!

1 Answer 1

4

It usually helps to properly format your queries. In your case, you're missing a curly brace before query_string and you have one too many comma after your query_string query.

Reformating like this will work:

curl -XGET '<myurl>:<myport>/index/_search?pretty' -d '
{
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "ip": "1.2.3.4"
          }
        },
        {
          "range": {
            "localtime": {
              "from": "2016-06-15T06:00:04.923Z",
              "to": "2016-06-17T17:43:04.923Z",
              "include_lower": true,
              "include_upper": true
            }
          }
        },
        {
          "query_string": {
            "default_field": "_all",
            "query": "word1 OR word1"
          }
        }
      ]
    }
  }
}'
Sign up to request clarification or add additional context in comments.

2 Comments

got the error msg : "reason" : "[term] query does not support array of values",
Val,would you help me to solve the problem stackoverflow.com/questions/37925507/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.