From 25d4357dd2115d9f8c96d9bbed0e2ac25499dc63 Mon Sep 17 00:00:00 2001 From: klacabane Date: Mon, 20 Dec 2021 14:55:30 +0100 Subject: [PATCH] adapt ES queries to updated document structure --- .../components/elasticsearch/shard_activity/parse_props.js | 3 ++- .../monitoring/server/lib/cluster/get_clusters_state.ts | 2 +- .../monitoring/server/lib/elasticsearch/get_last_recovery.ts | 2 +- .../elasticsearch/shards/get_indices_unassigned_shard_stats.ts | 2 +- .../server/lib/elasticsearch/shards/get_nodes_shard_count.ts | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/parse_props.js b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/parse_props.js index 9a102c52aa1f1..fee68dccf4fa3 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/parse_props.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/parse_props.js @@ -29,6 +29,7 @@ export const parseProps = (props) => { stage, index, index_name: indexName, + name: mbIndexName, primary: isPrimary, start_time_in_millis: startTimeInMillis, total_time_in_millis: totalTimeInMillis, @@ -42,7 +43,7 @@ export const parseProps = (props) => { const { files, size } = index; return { - name: indexName || index.name, + name: indexName || mbIndexName, shard: `${id} / ${isPrimary ? 'Primary' : 'Replica'}`, relocationType: type === 'PRIMARY_RELOCATION' ? 'Primary Relocation' : normalizeString(type), stage: normalizeString(stage), diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_state.ts b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_state.ts index d732b43bc203b..b47ff1251de0e 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_state.ts +++ b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_state.ts @@ -71,7 +71,7 @@ export function getClustersState( 'hits.hits._source.cluster_uuid', 'hits.hits._source.elasticsearch.cluster.id', 'hits.hits._source.cluster_state', - 'hits.hits._source.elasticsearch.cluster.stats.state', + 'hits.hits._source.elasticsearch.cluster.state', ], body: { query: { diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/get_last_recovery.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/get_last_recovery.ts index dccdefa457b1e..269da0a4a94ca 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/get_last_recovery.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/get_last_recovery.ts @@ -110,7 +110,7 @@ export async function getLastRecovery( }, }; const mbParams = { - index: mbIndexPattern, + index: esIndexPattern, size, ignore_unavailable: true, body: { diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_indices_unassigned_shard_stats.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_indices_unassigned_shard_stats.ts index 87f79ff5b9b44..6d8d6c6328202 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_indices_unassigned_shard_stats.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_indices_unassigned_shard_stats.ts @@ -32,7 +32,7 @@ async function getUnassignedShardData( } else if (cluster.elasticsearch?.cluster?.stats?.state?.state_uuid) { filters.push({ term: { - 'elasticsearch.cluster.stats.state.state_uuid': + 'elasticsearch.cluster.state.id': cluster.elasticsearch?.cluster?.stats?.state?.state_uuid, }, }); diff --git a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_nodes_shard_count.ts b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_nodes_shard_count.ts index 12ce144ebf5c5..38abff560b018 100644 --- a/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_nodes_shard_count.ts +++ b/x-pack/plugins/monitoring/server/lib/elasticsearch/shards/get_nodes_shard_count.ts @@ -30,7 +30,7 @@ async function getShardCountPerNode( } else if (cluster.elasticsearch?.cluster?.stats?.state?.state_uuid) { filters.push({ term: { - 'elasticsearch.cluster.stats.state.state_uuid': + 'elasticsearch.cluster.state.id': cluster.elasticsearch?.cluster?.stats?.state?.state_uuid, }, });