Reputation: 347
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?
Upvotes: 3
Views: 5278
Reputation: 217554
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"
}
}
}
Upvotes: 5