-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify date histogram meta and apply interval scaling to all levels #95206
Merged
flash1293
merged 9 commits into
elastic:master
from
flash1293:date-histogram-interval-bound-time-fields
Mar 31, 2021
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
df22cae
simplify date histogram meta and apply interval scaling to all levels
flash1293 e57838f
adjust documentation
flash1293 bf0306f
Merge remote-tracking branch 'upstream/master' into date-histogram-in…
flash1293 385e488
update docs
flash1293 fe846c3
fix error case
flash1293 19a2b36
Merge remote-tracking branch 'upstream/master' into date-histogram-in…
flash1293 7f2f799
Merge branch 'master' into date-histogram-interval-bound-time-fields
kibanamachine 563f42c
fix tests
flash1293 c76f5b1
Merge branch 'master' into date-histogram-interval-bound-time-fields
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this contain the default one? or we don't want the default one if this was provided ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It overwrites the default one - this is the same logic as
esaggs
uses for building the filter