Wildcard in metric field when using Elasticsearch

I would need to sum a fields matching a certain pattern together, but apparently it is not possible to use wildcard in metric sum field? Are there other ways to do this?

For example I would want to sum:

failure.testFailed: 1
failure.failedToReserveEnv: 3

sum failure.* = 4

  • What Grafana version and what operating system are you using?
  • What is your datasource?
  • What happened?
    Nothing is being returned so Grafana doesn’t expect wildcard.
  • What did you expect to happen?
    Wildcard being possible and Grafana summing the fields.

Hi @pyttei ,

Thanks for opening this post.

  • Please review the submission template and include more details:
  • What Grafana version and what operating system are you using?
  • What is your datasource?
  • What are you trying to achieve?
  • How are you trying to achieve it?
  • What happened?
  • What did you expect to happen?
  • Can you copy/paste the configuration(s) that you are having problems with?
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
  • Did you follow any online instructions? If so, what is the URL?

Added more info to the original post

Still looking for answer

Still looking for answer #2

I think this might be doable via Transform.

You will need to use the right one so that you can get the desired results.

Have you already tried Transform?

Yes I have tried all kinds of transformations but I have yet to find how to use them in my situation. Also it seems to be not possible to use variables in transformations, so it would not be useful in my situation as I would need variable with the wildcard.

For example:


Well I have not much experience with Elasticsearch data source but I still dig around and found some similar posts which might help you e.g.

1 -Regular Expression in Query

2- Grafana Regex Query

3- How does wildcard works?

4- Use Wildcard in Constant Variable

Also, a couple of links to the documentation as it states that it uses the lucerne query and wildcard or regex is possible;


It might give you some more information or otherwise, community members will try to help you once you update your post after trying out the above.

Hi pyttei,

I use a bucket script to sum over several fields.
Use a sum-metirc for each field, and than you can use a bucketscript to add all fields.
This approach only is usable for a distinct number of fields.

Hi @jlau
Thanks for the suggestion, however this is not usable in my situation, since I will not know precisely what the field names will be, this is why I need wildcard.

Hi @usmanahmad

Thanks for your suggestions. However, unfortunately these do not help in my situation.