Skip to content

Commit

Permalink
Add significant terms in tag cloud visualization (elastic#17770)
Browse files Browse the repository at this point in the history
* Allow significant terms for tag cloud

* Fix request before terms aggregation has configured

* Check if at least one agg is in array
  • Loading branch information
timroes committed Apr 25, 2018
1 parent c47948e commit 9b8e537
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core_plugins/tagcloud/public/tag_cloud_vis.js
Expand Up @@ -55,7 +55,7 @@ VisTypesRegistryProvider.register(function (Private) {
title: 'Tags',
min: 1,
max: 1,
aggFilter: ['terms']
aggFilter: ['terms', 'significant_terms']
}
])
}
Expand Down
7 changes: 6 additions & 1 deletion src/core_plugins/tagcloud/public/tag_cloud_visualization.js
Expand Up @@ -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;
Expand Down

0 comments on commit 9b8e537

Please sign in to comment.