i'm creating line graph for last 7 days of data with interval =1day but it gives me 8 data points (or buckets)
for example, today is thursday 18-jan-2018 then it gives me data from last thursday 11-jan-2018
so ideally it should give me 7 data points only but it gives 8 points
It may seem confusing but this is the desired behavior. Here are the data points:
January 11 (7 days ago)
January 12 (6 days ago)
January 13 (5 days ago)
January 14 (4 days ago)
January 15 (3 days ago)
January 16 (2 days ago)
January 17 (1 days ago)
January 18 (0 days ago)
If you're not rounding to the nearest day, both January 11 and January 18 will be partial buckets, which is why they're shaded in the graph.
Which data point are you expecting not to show up in the graph? If you're wanting exactly 7 data points, perhaps you should select a relative time range from 7 days ago (rounded to the nearest day) to 1 day ago (rounded to the nearest day). This will cause all of the buckets to be complete, but you'll also not see any data for today.
Is there any way to display the buckets /key_as_string value in hours as well when i select the interval 1 day.
for example :
i'm using the range filter query with date histogram aggregation with interval =1day
{
"range": {
"my_date": {
"gte": "now-6d/d",
"lte": "now/d" <----2018-01-16 at 06:00 AM
}
}
}
So i'm expecting the bucket values as per the the hour with interval 1day as shown below
"buckets": [
{
"key_as_string": "2018-01-16T06:00:00.000Z",
},
{
"key_as_string": "2018-01-15T06:00:00.000Z",
},
{
"key_as_string": "2018-01-14T06:00:00.000Z",
},
{
"key_as_string": "2018-01-13T06:00:00.000Z",
},
{
"key_as_string": "2018-01-12T06:00:00.000Z",
},
{
"key_as_string": "2018-01-11T06:00:00.000Z",
},
{
"key_as_string": "2018-01-10T06:00:00.000Z",
}
]
But the values of bucket are gettting rounded off to 00 hours like shown below
"key_as_string": "2018-01-16T00:00:00.000Z",
"key_as_string": "2018-01-15T00:00:00.000Z",
"key_as_string": "2018-01-13T00:00:00.000Z",
"key_as_string": "2018-01-12T00:00:00.000Z",
"key_as_string": "2018-01-11T00:00:00.000Z",
"key_as_string": "2018-01-10T00:00:00.000Z",
Is there any way to get exact bucket values as per the time of filter applied with the interval =1d?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.