Grafana Infinity Data Source : Grafana timestamp filter is not working as expected

Hello,

I am rendering a table with Grafana Infinity Datasource, it display the records correctly but when I am trying to use the time filter just above the table (let say as Last 5 minutes) it is still displaying all the records whereas I have few records for that interval.

image

Can anyone please help me on this ?

Regards
Lakshay

can you share your query?

@sowdenraymond is it linked to any query or it should be done at some data source configuration level?

the query please

1 Like

I am querying elastic search and using below query:


{
  "query": {
    "match_all": {}
  },
  "sort": [
    {
      "createdDate": {
        "order": "desc"
      }
    }
  ]
}

You need to pass date filter to your query. Like elastic search plugin, Infinity doesn’t append date filter automatically.

BTW, can’t you use Elastic search plugin itself?

@yesoreyeram thanks for the response. Actually based on the elasticsearch response I need to dynamically add some more fields to the table and for that I am using JSONata helper functions which I was not able to achieve via the Elasticsearch plugin.

As per your response “You need to pass date filter to your query”
Actually I am new to elasticsearch and grafana can you please suggest me how to do this in infinity plugin ?

@yesoreyeram any updates ?

@yesoreyeram can you please update how to make the grafana time filter work as I need it urgently ?

Also there is one more issue I am facing related to size of records, after 10000 records grafana is throwing bad request 400 whereas I can see the count in es records way more than 10K.

You need to use time filter in your query as specified in the elastic document Filtering by date and time as different fields - Elasticsearch - Discuss the Elastic Stack

In order to use grafana’s dashboard time range, you can use Grafana global variables in your query Add and manage variables | Grafana documentation

I don’t think this is an issue with Grafana/Infinity plugin. Instead of pulling 10K+ records, I suggest to query aggregated resutls / use group by mechanism in your query. It is not a good idea to pull 10K+ records

2 Likes

Run the same query on kibana and you will see exact same error.

@yesoreyeram I was looking for the second approach you provided and it worked. Thanks for the solution :slight_smile:

I understood like pulling more than 10K is not a good idea, but I need to understand that whether it is even to possible pull all the records from opensearch index to Grafana even though the “max_default_window” is set to 10K in opensearch ? If yes, can you please provide the solution that would be really helpful, please note, I don’t wish to update the index settings.

How do you expect grafana to bypass a remote setting the datasource itself cannot bypass

1 Like

you are correct but what I meant was if elasticsearch has some features that could render the next set of 10K records and so on. and because of this I came across this doc Paginate search results, but I am not sure if it is feasible to achieve in grafana. sorry for not mentioning in my prior reply.