How to write query in Dev tools to find expired date of customers by comparing current date?

I have a index that contains date field of customers that contains date of customers to be expired. Now my task is you to compare that date with current date(dynamically) changes as current date change gives result "expired" or "not expired" in new field.

let suppose expiry date is 2020-05-28 compare with current date returns "expired" in corresponding field.
let suppose expiry date is 2021-06-11 and current date is same then shows "not expired" but tomorrow current date change to 2021-06-12 now that field automatically change from "not Expired" to expired.

I want to visualize on the dashboard after performing these task and expired status changes automatically date changes.

What exactly do you want to visualize?

If this is about the count of expired / non-expired customers, you can use filters for this:

This is a lens table splitting up the documents by whether the @timestamp field is larger or smaller than "now" (which is the current time)

I have column name expiry_date that contains dates to be expired. I want to compare these dates with current date and visualize on the PIE Chart. If the date is expired then count expired if not then count "not Expired". If date is not defined then "N/A".

@timestamp was an example because my data set doesn't have an expiry_date field.

For the pie chart use a filters aggregation for the buckets and use these three KQL filters:

  • expiry_date > now (label "Active")
  • expiry_date <= now (label "Inactive")
  • NOT expiry_date: * (label "N/A")

For the metric use count

Okay sir let me try this.