kibana-123
Version:
Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic
14 lines (12 loc) • 351 B
JavaScript
import _ from 'lodash';
export default function (bucket, agg) {
if (bucket && _.isPlainObject(bucket.buckets)) {
return _.map(bucket.buckets, function (value, key) {
let item = _.cloneDeep(value);
item.key = agg ? agg.getKey(value, key) : key;
return item;
});
} else {
return bucket && bucket.buckets || [];
}
};