Issue with Filtering Paths Using Regex in Grafana and Elasticsearch

Hi!

Im trying to split some Elasticsearch values (jenkins jobs dir paths) into variables, so I can filter by job the dashboard.

The structure of the field is: DSI/enviroment/folder_1/folder_2/job.

So, I have different combinations

For example (not real paths):

DSI/dev/monitoring/alerts/teams_webhook
DSI/pre/monitoring/alerts/teams_webhook
DSI/pro/monitoring/triggers/cpu_load_fix
DSI/dev/programming/....
.
.

So, I want to get the following variables

-Enviroment
-Folder_1
-Folder_2
-Job

To get these variables, I’m combining term queries to filter each path as I select variables (this works incorrectly) and regex (to get the exact word between the /).

(data.buildVariables.JOB_NAME =~ data.fullProjectName.keyword)

To get the Enviroment I use:

To get the other variables I use:

I just change the query (adding the previous value) and the {1} vallue, by {2} and {3} to get the other positions.

As I mentioned earlier, the issue is that sometimes, when I select the variables and reach Job, instead of filtering properly, it returns all the available Job Names. I think this is because of how Grafana escapes the / characters to query Elasticsearch.
No matter what I change, I can’t seem to resolve it.

Thanks in advance for any help or suggestions!

Hi, anyone knows how to do this? Im not getting it…