Issue on my query

I would like to aggregate the result of the rows that have the error field with the same jobid

{
  "query": {
    "match_phrase": {
      "level": "ERROR"
    },
    "exists": {
      "field": "metadata.CSBJobId"
    },
    "aggs": {
      "unique_jobsid": {
        "terms": {
          "field": "metadata.CSBJobId"
        }
      }
    }
  }
}

but I have this error
[match_phrase] malformed query, expected [END_OBJECT] but found [FIELD_NAME]

{
  "query": {
    "bool": {
      "must": [
        {
          "match_phrase": {
            "level": "ERROR"
          }
        },
        {
          "exists": {
            "field": "metadata.CSBJobId"
          }
        }
      ]
    }
  },
    "aggs": {
      "unique_jobsid": {
        "terms": {
          "field": "metadata.CSBJobId"
        }
      }
    }
}

Please try using this query

same error [bool] malformed query, expected [END_OBJECT] but found [FIELD_NAME]

Can you please paste the complete GET query?

It's the one you gave me, I put it in the filter

Can you please completely remove the other filters and give it a try with prova filter and let me know.

the same