'ElasticSearch date format to get last Sunday
I know for ES now means today
Is there any way to get last Sunday using some combination of now?
Context: We use Kibana and want to create a dashboard with a filter such that everyday it shows data for date ranges from last Sunday to today.
Solution 1:[1]
You can simply use below range query:
Here, now/w will give result from Monday to today and now/w-1d will give result from Sunday to today.
POST timeindex/_search
{
"query": {
"range": {
"timestamp": {
"gte": "now/w-1d"
}
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sagar Patel |
