diff --git a/src/plugins/data/common/search/aggs/agg_configs.test.ts b/src/plugins/data/common/search/aggs/agg_configs.test.ts index 104cd3b2815bc..80e5a079cfd59 100644 --- a/src/plugins/data/common/search/aggs/agg_configs.test.ts +++ b/src/plugins/data/common/search/aggs/agg_configs.test.ts @@ -360,6 +360,7 @@ describe('AggConfigs', () => { "0": Object { "range": Object { "@timestamp": Object { + "format": "strict_date_optional_time", "gte": "2021-05-05T00:00:00.000Z", "lte": "2021-05-10T00:00:00.000Z", }, @@ -368,6 +369,7 @@ describe('AggConfigs', () => { "86400000": Object { "range": Object { "@timestamp": Object { + "format": "strict_date_optional_time", "gte": "2021-05-04T00:00:00.000Z", "lte": "2021-05-09T00:00:00.000Z", }, diff --git a/src/plugins/data/common/search/aggs/agg_configs.ts b/src/plugins/data/common/search/aggs/agg_configs.ts index 9a362466c0fd7..a022abba7fb45 100644 --- a/src/plugins/data/common/search/aggs/agg_configs.ts +++ b/src/plugins/data/common/search/aggs/agg_configs.ts @@ -406,6 +406,7 @@ export class AggConfigs { .map(([filter, field]) => ({ range: { [field]: { + format: 'strict_date_optional_time', gte: moment(filter?.query.range[field].gte).subtract(shift).toISOString(), lte: moment(filter?.query.range[field].lte).subtract(shift).toISOString(), }, diff --git a/src/plugins/data/common/search/aggs/utils/time_splits.ts b/src/plugins/data/common/search/aggs/utils/time_splits.ts index c4a603a383e38..2eb49d76c6082 100644 --- a/src/plugins/data/common/search/aggs/utils/time_splits.ts +++ b/src/plugins/data/common/search/aggs/utils/time_splits.ts @@ -430,6 +430,7 @@ export function insertTimeShiftSplit( filters[key] = { range: { [timeField]: { + format: 'strict_date_optional_time', gte: moment(timeFilter.query.range[timeField].gte).subtract(shift).toISOString(), lte: moment(timeFilter.query.range[timeField].lte).subtract(shift).toISOString(), },