3

In elasticsearch 5.6.2 and 5.6.3 (Ubuntu 16.04), this query

GET _search
{
   "simple_query_string": {
      "query": "test1 + test2",
      "analyzer": "snowball",
      "fields": ["myfield"],
      "default_operator": "and"
   }
}

Is causing this error

{
   "error": {
      "root_cause": [
         {
            "type": "parsing_exception",
            "reason": "Unknown key for a START_OBJECT in [simple_query_string].",
            "line": 2,
            "col": 44
         }
      ],
      "type": "parsing_exception",
      "reason": "Unknown key for a START_OBJECT in [simple_query_string].",
      "line": 2,
      "col": 44
   },
   "status": 400
}

This is almost the same as the first example here https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html

Can someone help me?

1 Answer 1

5

You need to include the simple_query_string inside the query section, like this:

GET _search
{
  "query": {
    "simple_query_string": {
      "query": "test1 + test2",
      "analyzer": "snowball",
      "fields": ["myfield"],
      "default_operator": "and"
    }
  }
}
Sign up to request clarification or add additional context in comments.

Comments

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.