Query to fetch data for current month

Hi all,

I'm trying to fetch data only for current month of april 2023.

For example,

I have a query filter condition in my search bar in my kibana data table as

configuredDate > now-30d

which gives me data for past 1 month.

But I want to fetch data from April 1st to April 28th 2023.
The above query fetches me data from March 30th 2023 to April 28th 2023.

I want to fetch data from 1st of the current month to current date for other queries.
This data may dynamic , but i want to fetch from 1st of current month i.e from April 1st 2023 to April 28th 2023 or current timestamp.

Any way to go about it?


Hello @Sandeep_Raju

You can try the below steps

1.Click on the quickselect icon
2. change to Absolute there you can mention the date you want

Refer the below screenshot

I'm using different queries in a single dashboard, so using Timepicker from timeframe is not possible as shown in below .

I cannot change in timeframe. It has to be within visualization.

Any ideas

Could you try this query and feedback

configuredDate >= "2023-04-01T00:00:00" AND configuredDate <= "now"

No, it has to be dynamic.
For example if I'm in May, it should show from May 01, 2023 to now

There is no easy way to do that...

What I have done to get something similar is use Lens:

For each visualization

Histogram is set to monthly

Then for Last Month Visualizations use the shift=1M in the metric calculation

Set the dashboard Time Picker to 31 Days or so.. or setup up customer quick picks via under Kibana Advanced settings...

Not perfect but may get you closer.

I have a dashboard that shows a year with Each Month and some Month Over Month this is how I do it... not exactly the same as yours but best I could do.

I tried in DSL query filter and it worked as below:

  "query": {
    "range": {
      "configuredDate": {
        "gte": "now/M"

Nicely done!

Makes sense now that I see it, I'll put that in my bag of tricks.

Today I Learned!

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