【问题标题】:malformed query, expected END_OBJECT but found FIELD_NAME error in Kibana (Elastic Search)格式错误的查询,预期为 END_OBJECT,但在 Kibana 中发现 FIELD_NAME 错误(弹性搜索)
【发布时间】:2017-06-01 11:41:51
【问题描述】:

我在我的 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"
      }
    }
  }
}

【问题讨论】:

    标签: elasticsearch kibana kibana-5


    【解决方案1】:

    您的查询格式不正确。改为这样写:

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

    【讨论】:

    • 你能解释一下你的答案吗?我不明白我们在哪里需要什么类型的括号。
    • @Howdy 你的shouldfilter 部分以及minimum_number_should_match 都应该位于bool 部分内
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-01
    • 2018-02-10
    • 2018-04-25
    • 2021-04-22
    • 2020-02-26
    • 1970-01-01
    • 2018-01-30
    相关资源
    最近更新 更多