i have a query for which response buckets created for previous dates and if we are removing offset for the query then buckets are getting created for same date range
GET fpm/_search
{ "size" : 0,
"query" : {
"bool" : {
"filter" : [{
"terms" : {
"dim.source_collection_type.keyword" : [
"FPM"],
"boost" : 1.0
}}, {
"range" : {
"d" : {
"from" : "2018-11-05T00:00:00.000-0800",
"to" : "2018-11-05T23:59:59.000-0800",
"include_lower" : true,
"include_upper" : true,
"boost" : 1.0
} }},{
"terms" : {
"dim.lID.keyword" : [
"1990_70"
],
"boost" : 1.0
}
},
{
"terms" : {
"tID" : [
1990
],
"boost" : 1.0
}
}
],
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
"aggregations" : {
"date" : {
"date_histogram" : {
"field" : "d",
"format" : "yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"time_zone" : "America/Los_Angeles",
"interval" : "1d",
"offset": "8h",
"order" : {
"_key" : "asc"
},
"keyed" : false,
"min_doc_count" : 0
},
"aggregations" : {
"tCount" : {
"value_count" : {
"field" : "dim.source_collection_type.keyword"
}
},
"likeCount" : {
"sum" : {
"field" : "m.likes"
}
},
"commentsCount" : {
"sum" : {
"field" : "m.comments"
}
},
"sharesCount" : {
"sum" : {
"field" : "m.shares"}}}}}}
response for the above query:
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 6,
"successful": 6,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 13,
"max_score": 0,
"hits": []
},
"aggregations": {
"date": {
"buckets": [
{
"key_as_string": "2018-11-04T07:00:00.000-0800",
"key": 1541343600000,
"doc_count": 2,
"sharesCount": {
"value": 0
},
"commentsCount": {
"value": 0
},
"likeCount": {
"value": 0
},
"tCount": {
"value": 2
}
},
{
"key_as_string": "2018-11-05T08:00:00.000-0800",
"key": 1541433600000,
"doc_count": 11,
"sharesCount": {
"value": 0
},
"commentsCount": {
"value": 2
},
"likeCount": {
"value": 0
},
"tCount": {
"value": 11
}
}
]
}
}
}
if offset is removed from query:
GET fpm/_search
{
"size" : 0,
"query" : {
"bool" : {
"filter" : [
{
"terms" : {
"dim.source_collection_type.keyword" : [
"FPM"
],
"boost" : 1.0
}
},
{
"range" : {
"d" : {
"from" : "2018-11-05T00:00:00.000-0800",
"to" : "2018-11-05T23:59:59.000-0800",
"include_lower" : true,
"include_upper" : true,
"boost" : 1.0
}
}
},
{
"terms" : {
"dim.lID.keyword" : [
"1990_70"
],
"boost" : 1.0
}
},
{
"terms" : {
"tID" : [
1990
],
"boost" : 1.0
}
}
],
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
"aggregations" : {
"date" : {
"date_histogram" : {
"field" : "d",
"format" : "yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"time_zone" : "America/Los_Angeles",
"interval" : "1d",
"order" : {
"_key" : "asc"
},
"keyed" : false,
"min_doc_count" : 0
},
"aggregations" : {
"tCount" : {
"value_count" : {
"field" : "dim.source_collection_type.keyword"
}
},
"likeCount" : {
"sum" : {
"field" : "m.likes"}},
"commentsCount" : {
"sum" : {
"field" : "m.comments"}},
"sharesCount" : {
"sum" : {
"field" : "m.shares"}}}}} }
response for this query is:
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 6,
"successful": 6,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 13,
"max_score": 0,
"hits": []},
"aggregations": {
"date": {
"buckets": [{
"key_as_string": "2018-11-05T00:00:00.000-0800",
"key": 1541404800000,
"doc_count": 13,
"sharesCount": {
"value": 0
},
"commentsCount": {
"value": 2
},
"likeCount": {
"value": 0
},
"tCount": {
"value": 13}}]}}}
Can any one explain the reason for different responses