弹性搜索中的排除查询无法解析搜索源。期望的字段名称,但得到[START_OBJECT]

时间:2017-02-28 12:42:47

标签: curl elasticsearch kibana

我有以下查询,其中 1.获取logtype错误的所有数据。 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*"
                  }
               }
            }
         }
    }
}
'

但是上面的命令给出了:

 {
    "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
 }

如何解决?

1 个答案:

答案 0 :(得分:1)

试试这个:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender