-
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.
Filter aggregation fields for rollup indices, reorganize rollup direc…
…tory
- Loading branch information
Showing
4 changed files
with
31 additions
and
2 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
28 changes: 28 additions & 0 deletions
28
x-pack/plugins/rollup/public/visualize/agg_type_field_filter.js
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,28 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { aggTypeFieldFilters } from 'ui/agg_types/param_types/filter'; | ||
|
||
/** | ||
* If rollup index pattern, check its capabilities | ||
* and limit available fields for a given aggType based on that. | ||
*/ | ||
aggTypeFieldFilters.addFilter( | ||
(field, fieldParamType, indexPattern, aggConfig) => { | ||
if(indexPattern.type !== 'rollup') { | ||
return true; | ||
} | ||
|
||
const fieldName = field.name; | ||
const aggName = aggConfig.type.name; | ||
const jobs = indexPattern.typeMeta.jobs; | ||
|
||
return !!jobs.find(job => { | ||
const fields = indexPattern.typeMeta.capabilities[job].fields; | ||
return fields[fieldName] && fields[fieldName].find(agg => agg.agg === aggName); | ||
}); | ||
} | ||
); |
File renamed without changes.
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