Add significant terms in tag cloud visualization (#17770)

* Allow significant terms for tag cloud

* Fix request before terms aggregation has configured

* Check if at least one agg is in array
This commit is contained in:
Tim Roes 2018-04-25 14:34:41 +02:00 committed by GitHub
parent 7625c3fcd4
commit ef8657067a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -55,7 +55,7 @@ VisTypesRegistryProvider.register(function (Private) {
title: 'Tags',
min: 1,
max: 1,
aggFilter: ['terms']
aggFilter: ['terms', 'significant_terms']
}
])
}

View file

@ -92,7 +92,12 @@ export class TagCloudVisualization {
}
const data = response.tables[0];
this._bucketAgg = this._vis.aggs.find(agg => agg.type.name === 'terms');
const segmentAggs = this._vis.aggs.bySchemaName.segment;
if (segmentAggs && segmentAggs.length > 0) {
this._bucketAgg = segmentAggs[0];
} else {
this._bucketAgg = null;
}
const tags = data.rows.map(row => {
const [tag, count] = row;