Dynamic dropdown not changing

Hi all,

For my Kibana dashboard I want to have 2 dropdowns (of type ES|QL control), one with the API’s and another one with the endpoint corresponding to the API selected in the first dropdown. So for example, if API == 1, the endpoint should have options A, B and C, but if the API == 2, the endpoint should have options D, E and F. I’ve tried to realise this by adding the following data view called api-endpiont-matching:

API Endpoint
1 A
1 B
1 C
2 D
2 E
2 F
3 G
3 H
3 I

For the first dropdown I define the name as ?api and populate the values with this query:

FROM api-endpoint-matching 
| STATS BY api

For the second dropdown I define the name as ?endpoint and populate the values with this query:

FROM api-endpoint-matching 
| WHERE api == ?api
| STATS BY endpoint

The first dropdown works just fine. But the second one doesn’t change all when I change the first dropdown.

Do you have any suggestions on how to fix this? I should be able to reference the value of one dropdown in the query of another dropdown right?

Hello @Sanderb

Welcome to the Community!!

I also faced the same issue while using ES|QL ,

ELK version 9.1.5

Please find below details used :

ES|QL index/dropdown details
PUT api_endpoints_v2
{
  "mappings": {
    "properties": {
      "@timestamp": {
        "type": "date"
      },
      "API": {
        "type": "keyword"
      },
      "Endpoint": {
        "type": "keyword"
      }
    }
  }
}

Index created with below 9 values :

API	Endpoint
1	A
1	B
1	C
2	D
2	E
2	F
3	G
3	H
3	I


Dropdown API => ?variable
FROM api_endpoints_v2 
| STATS BY API

Dropdown Endpoint => ?variable1 (It does not allow to save)
FROM api_endpoints_v2
| WHERE API == ?variable
| STATS BY Endpoint

Panel
FROM api_endpoints 
| WHERE API == ?variable AND Endpoint == ?variable1
| KEEP @timestamp,API,Endpoint


Hello Team,

Could you please confirm if it is possible to create a dependent dropdown via ES|QL which can have dynamic values as per value selected in dropdown 1 ?

Thanks!!

1 Like

I probably got it working by adding 2 new columns to the data set named API en Endpoint and filling these with a painless script. Then creating the 2 dropdowns based on these new columns.

But if there’s a fix for my originally intended ES|QL approach I’d be very happy to hear so!

Regarding your question: yeah the first drodown works just fine as intended.

1 Like