I want to load the production elastic if I select production as value of the env variabele and for instance, if I select pre-production it selects that datasource.
Create the datasource with name development-datasource01,development-datasource02,production-datasource02 and production-datasource02. I assume the same type
In the dashboard variable create 1st variable
Fill the name with Environment, choose Type: Custom
Fill the Custom Options with development,production
Update the variable
Create 2nd variable
Fill the name with Datasource, choose the Type: Datasource
Fill the Data Source Option with Elasticsearch
Fill the Inatance name filter with: $Environment
Update the Variable
Back to dashboard and try to select the Environment, you will get the different datasource in the varibale Datasource