Reputation: 3
I have created a document in my ES index. I need to run a search query.
This is my search payload.
{
"highlight": {
"require_field_match": true,
"pre_tags": [
"<span class=\"searchKeyHighlight\">"
],
"post_tags": [
"</span>"
],
"fields": {}
},
"query": {
"query_string": {
"multi_match": {
"default_operator": "AND",
"query": "xyz"
}
}
}
}
This is the error I get.
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[query_string] unknown token [START_OBJECT] after [multi_match]",
"line": 1,
"col": 170
}
],
"type": "parsing_exception",
"reason": "[query_string] unknown token [START_OBJECT] after [multi_match]",
"line": 1,
"col": 170
},
"status": 400
}
The col 170 is the colon after multi_match in the search query "multi_match":{"default_operator"
.
I am using elasticsearch version 5.0.0.
Version: 5.0.0, Build: 253032b/2016-10-26T04:37:51.531Z, JVM: 1.8.0_102
I don't understand what is wrong in the multi_match query.
Upvotes: 0
Views: 7472
Reputation: 1061
Try below query. You can use either query_string or multi_match, both you can't use.
{
"highlight": {
"require_field_match": true,
"pre_tags": [
"<span class=\"searchKeyHighlight\">"
],
"post_tags": [
"</span>"
],
"fields": {}
},
"query": {
"query_string": {
"default_operator": "AND",
"query": "xyz"
}
}
}
Upvotes: 2