Distorted query expected by END_OBJECT, but found FIELD_NAME error in Kibana (Elastic Search)

I run the following GET request in my Kibana console, and for some reason I get an error message in the response window as follows:

//error

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

Can anyone suggest why I cannot use multiple matching blocks in the should section?

// response - if I take out one of the matching blocks, which one does it work?

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

// my request

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

Your request is incorrect. Instead, write:

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

Source: https://habr.com/ru/post/1678335/


All Articles