Skip to content

Commit

Permalink
Filtered histogram types out of the top_hit and cardinality aggregati…
Browse files Browse the repository at this point in the history
…ons, and allowed histogram type to be used in the median aggregation
  • Loading branch information
ThomThomson committed Mar 19, 2020
1 parent 0354bbe commit cb26162
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/plugins/data/public/search/aggs/metrics/cardinality.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ export const cardinalityMetricAgg = new MetricAggType({
{
name: 'field',
type: 'field',
filterFieldTypes: Object.values(KBN_FIELD_TYPES).filter(
type => type !== KBN_FIELD_TYPES.HISTOGRAM
),
},
],
});
2 changes: 1 addition & 1 deletion src/plugins/data/public/search/aggs/metrics/median.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const medianMetricAgg = new MetricAggType({
{
name: 'field',
type: 'field',
filterFieldTypes: [KBN_FIELD_TYPES.NUMBER, KBN_FIELD_TYPES.DATE],
filterFieldTypes: [KBN_FIELD_TYPES.NUMBER, KBN_FIELD_TYPES.DATE, KBN_FIELD_TYPES.HISTOGRAM],
write(agg, output) {
output.params.field = agg.getParam('field').name;
output.params.percents = [50];
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/data/public/search/aggs/metrics/top_hit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ export const topHitMetricAgg = new MetricAggType({
name: 'field',
type: 'field',
onlyAggregatable: false,
filterFieldTypes: '*',
filterFieldTypes: Object.values(KBN_FIELD_TYPES).filter(
type => type !== KBN_FIELD_TYPES.HISTOGRAM
),
write(agg, output) {
const field = agg.getParam('field');
output.params = {};
Expand Down

0 comments on commit cb26162

Please sign in to comment.