Filtering results from elasticsearch


I’m trying to vizualize some data from elasticsearch with a time series panel.
Grafana version : v8.3.1
Elasticsearch : 7.15.2
Elasticsearch data source version on grafana : 7.10+

My document is something like this:

"hits":[{"_index":"SomeIndex","_type":"_doc","_id":"VjUhT4UBVgxLgljEQ0fk","_score":1.0,"_source":{"@timestamp": 1671030000000.0, "Heure": "14/12/2022 16:0", "Produit": "PRODUCT1", "param1": 10, "param2": 0}},
"_index":"SomeIndex","_type":"_doc","_id":"VjUhT4UBVgxLgljEQ0fk","_score":1.0,"_source":{"@timestamp": 1671030000000.0, "Heure": "14/12/2022 16:0", "Produit": "PRODUCT2", "param1": 10, "param2": 0}},
"_index":"SomeIndex","_type":"_doc","_id":"VjUhT4UBVgxLgljEQ0fk","_score":1.0,"_source":{"@timestamp": 1671033600000.0, "Heure": "14/12/2022 17:0", "Produit": "PRODUCT1", "param1": 13, "param2": 3}},
"_index":"SomeIndex","_type":"_doc","_id":"VjUhT4UBVgxLgljEQ0fk","_score":1.0,"_source":{"@timestamp": 1671033600000.0, "Heure": "14/12/2022 17:0", "Produit": "PRODUCT2", "param1": 7, "param2": 1}},...]

I need to vizualize the variation of param1 over time for PRODUCT1.

I tried to add a “Filter data by values” transformation but i’m not getting the field “Produit” to apply the condition.

Is there any other option that could help me to do this?

Thank you


Hi @saidtig,

Welcome to the :grafana: community support forums !!

Well, I am not yet expert with Elasticsearch datasource but I think I might be able to help you with what you looking for with Transformation.

Yes, you can use the “filter by value” but then use regex.

Here is a good link to a post which explains as how to use it and also link to the documentation as how to use regex.

I hope this helps.

If you can use query you can use something like this

  "query": {
    "match_phrase": {
      "Produit": "PRODUCT1"