How do we config variables using elasticsearch source?

Hello everyone!
I want to add a new variable to the variable in the grafana dashboard, which is obtained by the aggregate query of elasticsearch, how should I do it?
Thank you