-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify date histogram meta and apply interval scaling to all levels (…
- Loading branch information
Showing
32 changed files
with
249 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...ugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.settimefields.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [AggConfigs](./kibana-plugin-plugins-data-public.aggconfigs.md) > [setTimeFields](./kibana-plugin-plugins-data-public.aggconfigs.settimefields.md) | ||
|
||
## AggConfigs.setTimeFields() method | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
setTimeFields(timeFields: string[] | undefined): void; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| timeFields | <code>string[] | undefined</code> | | | ||
|
||
<b>Returns:</b> | ||
|
||
`void` | ||
|
11 changes: 11 additions & 0 deletions
11
.../plugins/data/public/kibana-plugin-plugins-data-public.aggconfigs.timefields.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [AggConfigs](./kibana-plugin-plugins-data-public.aggconfigs.md) > [timeFields](./kibana-plugin-plugins-data-public.aggconfigs.timefields.md) | ||
|
||
## AggConfigs.timeFields property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
timeFields?: string[]; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/plugins/data/common/search/aggs/utils/get_date_histogram_meta.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { DatatableColumn } from 'src/plugins/expressions/common'; | ||
import { TimeRange } from '../../../types'; | ||
import type { AggParamsDateHistogram } from '../buckets'; | ||
import { BUCKET_TYPES } from '../buckets/bucket_agg_types'; | ||
|
||
/** | ||
* Helper function returning the used interval, used time zone and applied time filters for data table column created by the date_histogramm agg type. | ||
* "auto" will get expanded to the actually used interval. | ||
* If the column is not a column created by a date_histogram aggregation of the esaggs data source, | ||
* this function will return undefined. | ||
*/ | ||
export const getDateHistogramMetaDataByDatatableColumn = (column: DatatableColumn) => { | ||
if (column.meta.source !== 'esaggs') return; | ||
if (column.meta.sourceParams?.type !== BUCKET_TYPES.DATE_HISTOGRAM) return; | ||
const params = (column.meta.sourceParams.params as unknown) as AggParamsDateHistogram; | ||
|
||
let interval: string | undefined; | ||
if (params.used_interval && params.used_interval !== 'auto') { | ||
interval = params.used_interval; | ||
} | ||
|
||
return { | ||
interval, | ||
timeZone: params.used_time_zone, | ||
timeRange: column.meta.sourceParams.appliedTimeRange as TimeRange | undefined, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.