Skip to content
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

Show warning notification when sorting in asc order by count in term agg #8050

Merged
merged 7 commits into from
Aug 23, 2016
8 changes: 8 additions & 0 deletions src/ui/public/agg_types/buckets/terms.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Notifier from 'ui/notify/notifier';

define(function (require) {
return function TermsAggDefinition(Private) {
let _ = require('lodash');
Expand All @@ -6,6 +8,7 @@ define(function (require) {
let AggConfig = Private(require('ui/Vis/AggConfig'));
let Schemas = Private(require('ui/Vis/Schemas'));
let createFilter = Private(require('ui/agg_types/buckets/create_filter/terms'));
const notify = new Notifier();

let orderAggSchema = (new Schemas([
{
Expand Down Expand Up @@ -130,6 +133,11 @@ define(function (require) {

let orderAgg = agg.params.orderAgg || vis.aggs.getResponseAggById(agg.params.orderBy);

const orderBy = orderAgg.type.name;
if (orderBy === 'count' && dir === 'asc') {
notify.warning('Sorting in Ascending order by Count in Terms aggregations is deprecated');
}

// TODO: This works around an Elasticsearch bug the always casts terms agg scripts to strings
// thus causing issues with filtering. This probably causes other issues since float might not
// be able to contain the number on the elasticsearch side
Expand Down