Elasticsearch query transform to Grafana

Hi everyone!

I have a query that I use in Kibana to search in Elasticsearch and want to do the same with Grafana.

The query is:

GET /my_index3/_search
{
  "size": 0,
  "aggs": {
    "num1": {
      "terms": {
        "field": "num1.keyword",
        "order": {
          "_count": "desc"
        }
      },
        "aggs": {
          "count_of_suffix": {
            "cardinality": {
              "field": "suffix.keyword"
            }
          },

            "my_filter": {
              "bucket_selector": {
                "buckets_path": {
                  "count_of_suffix": "count_of_suffix"
                },
                "script": "params.count_of_suffix == 2"
              }
            }
        
      }
    }
  }
}

My question is, how can I get the same result in Grafana. When I type the same code into Lucene query it gives me an error.

Any help would be really appreciated!

Maybe are you using nested fields (i.e. num1.keyword, suffix.keyword) ?

AFAIK, Grafana does not currently support them. Follow this Github link for more information.