格式错误的查询,预期END_OBJECT但在Kibana中发现FIELD_NAME错误(弹性搜索)

时间:2017-06-01 11:41:52

标签: elasticsearch kibana kibana-5

我在Kibana控制台中运行以下GET查询,由于某种原因,我在响应窗口中收到错误,如下所示:

//错误

[match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]

任何人都可以建议为什么我无法使用多个匹配区块来应该'部?

//响应 - 如果我取出其中一个匹配块,它的工作原理?

{
  "error": {
   "root_cause": [
     {
       "type": "parsing_exception",
       "reason": "[match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
        "line": 9,
        "col": 13
     }
   ],
    "type": "parsing_exception",
    "reason": "[match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
    "line": 9,
    "col": 13
   },
   "status": 400
}

//我的查询

GET _search
  {
    "query": {
      "bool": {
        "should": [
        {
           "match": {
           "text": "facebook advice"
        },
           "match": {
           "profile": "facebook advice"
        }
      }
    ],
    "minimum_number_should_match": 1,
    "filter": {
      "term": {
        "accountid": "22"
      }
    }
  }
}

1 个答案:

答案 0 :(得分:16)

您的查询格式错误。这样写它:

GET _search
{
  "query": {
    "bool": {
      "should": [
        {
          "match": {
            "text": "facebook advice"
          }
        },
        {
          "match": {
            "profile": "facebook advice"
          }
        }
      ],
      "minimum_number_should_match": 1,
      "filter": {
        "term": {
          "accountid": "22"
        }
      }
    }
  }
}