diff --git a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.js b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.js index 2f4541264a488..fc571dac19b0f 100644 --- a/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.js +++ b/x-pack/plugins/monitoring/server/lib/cluster/get_clusters_from_request.js @@ -21,7 +21,7 @@ import { CLUSTER_ALERTS_SEARCH_SIZE, STANDALONE_CLUSTER_CLUSTER_UUID } from '../ import { getApmsForClusters } from '../apm/get_apms_for_clusters'; import { i18n } from '@kbn/i18n'; import { checkCcrEnabled } from '../elasticsearch/ccr'; -import { standaloneClusterDefinition, hasStandaloneClusters } from '../standalone_clusters'; +import { getStandaloneClusterDefinition, hasStandaloneClusters } from '../standalone_clusters'; /** * Get all clusters or the cluster associated with {@code clusterUuid} when it is defined. @@ -41,7 +41,7 @@ export async function getClustersFromRequest(req, indexPatterns, { clusterUuid, let clusters = []; if (isStandaloneCluster) { - clusters.push(standaloneClusterDefinition); + clusters.push(getStandaloneClusterDefinition()); } else { // get clusters with stats and cluster state @@ -56,7 +56,7 @@ export async function getClustersFromRequest(req, indexPatterns, { clusterUuid, ]; if (await hasStandaloneClusters(req, indexPatternsToCheckForNonClusters)) { - clusters.push(standaloneClusterDefinition); + clusters.push(getStandaloneClusterDefinition()); } } @@ -112,6 +112,7 @@ export async function getClustersFromRequest(req, indexPatterns, { clusterUuid, } // add kibana data + const kibanas = isStandaloneCluster ? [] : await getKibanasForClusters(req, kbnIndexPattern, clusters); // add the kibana data to each cluster kibanas.forEach(kibana => { diff --git a/x-pack/plugins/monitoring/server/lib/standalone_clusters/standalone_cluster_definition.js b/x-pack/plugins/monitoring/server/lib/standalone_clusters/get_standalone_cluster_definition.js similarity index 57% rename from x-pack/plugins/monitoring/server/lib/standalone_clusters/standalone_cluster_definition.js rename to x-pack/plugins/monitoring/server/lib/standalone_clusters/get_standalone_cluster_definition.js index 78b8c017d7a53..362cb015cd42a 100644 --- a/x-pack/plugins/monitoring/server/lib/standalone_clusters/standalone_cluster_definition.js +++ b/x-pack/plugins/monitoring/server/lib/standalone_clusters/get_standalone_cluster_definition.js @@ -5,14 +5,16 @@ */ import { STANDALONE_CLUSTER_CLUSTER_UUID } from '../../../common/constants'; -export const standaloneClusterDefinition = { - cluster_uuid: STANDALONE_CLUSTER_CLUSTER_UUID, - license: {}, - cluster_state: {}, - cluster_stats: { - nodes: { - jvm: {}, - count: {} +export const getStandaloneClusterDefinition = () => { + return { + cluster_uuid: STANDALONE_CLUSTER_CLUSTER_UUID, + license: {}, + cluster_state: {}, + cluster_stats: { + nodes: { + jvm: {}, + count: {} + } } - } + }; }; diff --git a/x-pack/plugins/monitoring/server/lib/standalone_clusters/index.js b/x-pack/plugins/monitoring/server/lib/standalone_clusters/index.js index 5ff0c03b40da5..3f6151cc8eb8f 100644 --- a/x-pack/plugins/monitoring/server/lib/standalone_clusters/index.js +++ b/x-pack/plugins/monitoring/server/lib/standalone_clusters/index.js @@ -5,5 +5,5 @@ */ export { hasStandaloneClusters } from './has_standalone_clusters'; -export { standaloneClusterDefinition } from './standalone_cluster_definition'; +export { getStandaloneClusterDefinition } from './get_standalone_cluster_definition'; export { standaloneClusterFilter } from './standalone_cluster_query_filter'; diff --git a/x-pack/test/functional/es_archives/monitoring/standalone_cluster/mappings.json b/x-pack/test/functional/es_archives/monitoring/standalone_cluster/mappings.json new file mode 100644 index 0000000000000..18c67e2218a5d --- /dev/null +++ b/x-pack/test/functional/es_archives/monitoring/standalone_cluster/mappings.json @@ -0,0 +1,59 @@ +{ + "type": "index", + "value": { + "index": ".monitoring-es-6-2019.02.04", + "settings": { + "index": { + "codec": "best_compression", + "format": "6", + "number_of_replicas": "1", + "number_of_shards": "1" + } + } + } +} + +{ + "type": "index", + "value": { + "index": ".monitoring-alerts-6", + "settings": { + "index": { + "codec": "best_compression", + "format": "6", + "number_of_replicas": "1", + "number_of_shards": "1" + } + } + } +} + +{ + "type": "index", + "value": { + "index": ".monitoring-kibana-6-2019.02.04", + "settings": { + "index": { + "codec": "best_compression", + "format": "6", + "number_of_replicas": "1", + "number_of_shards": "1" + } + } + } +} + +{ + "type": "index", + "value": { + "index": ".monitoring-beats-6-2019.02.04", + "settings": { + "index": { + "codec": "best_compression", + "format": "6", + "number_of_replicas": "1", + "number_of_shards": "1" + } + } + } +}