Skip to content

Commit

Permalink
Backport #51, #52, #53, #54, #55, #56
Browse files Browse the repository at this point in the history
(cherry picked from commit e047780)

Additional work for #54

(cherry picked from commit 6f80501)

Additional work for #55

(cherry picked from commit 54c7afb)

fix #56

(cherry picked from commit 919fb59)

update to next version
  • Loading branch information
ppadovani authored and Pierre Padovani committed Mar 30, 2018
1 parent dd66520 commit 0830e8c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nested-fields-support",
"version": "6.2.1-1.0.4",
"version": "6.2.1-1.0.5",
"description": "Nested Support Plugin",
"license": "Apache-2.0",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion public/nested_support/agg_response/tabify/tabify.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ tabify.AggResponseTabifyProvider = function(Private, Notifier) {
const splitting = write.canSplit && agg.schema.name === 'split';
if (splitting) {
write.split(agg, buckets, function forEachBucket(subBucket, key) {
collectBucket(write, agg.id, subBucket, agg.getKey(subBucket), key, aggScale);
collectBucket(write, agg.id, subBucket, agg.getKey(subBucket, key), aggScale);
});
} else {
buckets.forEach(function (subBucket, key) {
Expand Down
8 changes: 6 additions & 2 deletions public/nested_support/agg_types/buckets/terms.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ Terms.AggTypesBucketsTermsProvider = function(Private) {
if (dir === 'asc') {
routeBasedNotifier.warning('Sorting in Ascending order by Count in Terms aggregations is deprecated');
}
order._count = dir;
if (agg.params.countByParent) {
order['count_' + agg.id] = dir;
} else {
order._count = dir;
}
return;
}

Expand All @@ -239,7 +243,7 @@ Terms.AggTypesBucketsTermsProvider = function(Private) {
}

// if the target aggregation is nested, refer to it by its nested location
if (orderAgg.nestedPath || orderAgg.reverseNested) {
if ((!orderAgg.params.field.nestedPath && agg.params.field.nestedPath) || orderAgg.params.field.nestedPath !== agg.params.field.nestedPath) {
orderAggId = 'nested_' + orderAggId + '>' + orderAggId;
}

Expand Down
3 changes: 3 additions & 0 deletions public/nested_support/index_patterns/_flatten_hit.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ export function IndexPatternsNestedFlattenHitProvider(config) {

return function flattenHitWrapper(indexPattern) {
return function cachedFlatten(hit, deep = false) {
if (!deep) {
deep = indexPattern.nested;
}
return hit.$$_flattened || (hit.$$_flattened = flattenHit(indexPattern, hit, deep));
};
};
Expand Down

0 comments on commit 0830e8c

Please sign in to comment.