Skip to content

Commit

Permalink
Fixed aggs parsing error (#99159) (#99422)
Browse files Browse the repository at this point in the history
# Conflicts:
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_index_shard_size.ts
  • Loading branch information
igoristic authored May 6, 2021
1 parent 74c9a34 commit 99a92d4
Showing 1 changed file with 23 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,36 +67,32 @@ export async function fetchIndexShardSize(
size,
},
aggs: {
over_threshold: {
index: {
terms: {
field: 'index_stats.index',
size,
},
aggs: {
index: {
terms: {
field: 'index_stats.index',
size,
},
aggs: {
hits: {
top_hits: {
sort: [
{
timestamp: {
order: 'desc',
unmapped_type: 'long',
},
},
],
_source: {
includes: [
'_index',
'index_stats.shards.primaries',
'index_stats.primaries.store.size_in_bytes',
'source_node.name',
'source_node.uuid',
],
hits: {
top_hits: {
sort: [
{
timestamp: {
order: 'desc' as const,
unmapped_type: 'long' as const,
},
size: 1,
},
],
_source: {
includes: [
'_index',
'index_stats.shards.primaries',
'index_stats.primaries.store.size_in_bytes',
'source_node.name',
'source_node.uuid',
],
},
size: 1,
},
},
},
Expand All @@ -117,7 +113,7 @@ export async function fetchIndexShardSize(
}
const thresholdBytes = threshold * gbMultiplier;
for (const clusterBucket of clusterBuckets) {
const indexBuckets = clusterBucket.over_threshold.index.buckets;
const indexBuckets = clusterBucket.index.buckets;
const clusterUuid = clusterBucket.key;

for (const indexBucket of indexBuckets) {
Expand Down

0 comments on commit 99a92d4

Please sign in to comment.