[英]Exclude in elasticsearch query gives failed to parse search source. expected field name but got [START_OBJECT]
I have following query, which 1. get all data with logtype error. 我有以下查询,该查询1.获取所有具有logtype错误的数据。 2. exclude all data in which there is
error occured
in logmessage fields. 2.排除logmessage字段中
error occured
所有数据。
curl -s -XGET 'localhost:9200/index_name/type/_search?pretty=true&size=10' -d '
{
"query": {
"match" : {
"logtype" : "error"
},
"should": {
"bool": {
"must_not": {
"match": {
"logMessage": "*error occured*"
}
}
}
}
}
}
'
But the above command gives: 但是上面的命令给出:
{
"error": {
"root_cause": [{
"type": "parse_exception",
"reason": "failed to parse search source. expected field name but got [START_OBJECT]"
}],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [{
"shard": 0,
"index": "indexname",
"node": "HxII3rajS4KP5dkP-ZvPSw",
"reason": {
"type": "parse_exception",
"reason": "failed to parse search source. expected field name but got [START_OBJECT]"
}
}]
},
"status": 400
}
How can it be solved? 如何解决?
Try this: 尝试这个:
curl -s -XGET 'localhost:9200/index_name/type/_search?pretty=true&size=10' -d '{
"query": {
"bool": {
"must": {
"match": {
"logtype": "error"
}
},
"must_not": {
"match": {
"logMessage": "*error occured*"
}
}
}
}
}'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.