Define global variables for the Kibana watches

I have several Kibana watches using the same variables in their query, e.g. k8s_env in this example watch query

          "must": [
            {
              "query_string": {
                "query": "error" AND k8s_env:(\”abc-prod\" OR \"def-prod\" OR \”xyz-prod\")
                "analyze_wildcard": true
              }
            }, ….

If I need to change the variable k8s_env anytime to make changes to the environments, I need to change the body of each watch and I have too many of those watches.

I am looking to define a global variable ‘k8s_env’ somewhere, so that it is available to the watches and hence when our environments change, I need to make the change only in one place in the config file and not all the watches which I do now.
So my questions are:

  • Where do I define a global variable so that it is available to the watches?
  • Is there a PUT API that I can use to PUT or define some variables so the watches can access them?

We deploy elastic search and the kibana watches using ansible.

This kind of global variable functionality would need to be added to Elasticsearch. Could you please file an enhancement request on the ES repo?

Thanks,
CJ

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.