diff --git a/x-pack/plugins/observability/server/services/slo/fixtures/slo.ts b/x-pack/plugins/observability/server/services/slo/fixtures/slo.ts index bebd153690b50..494c54cd65741 100644 --- a/x-pack/plugins/observability/server/services/slo/fixtures/slo.ts +++ b/x-pack/plugins/observability/server/services/slo/fixtures/slo.ts @@ -58,7 +58,7 @@ export const createKQLCustomIndicator = ( ): Indicator => ({ type: 'sli.kql.custom', params: { - index: 'my-index*', + index: 'my-index*,my-other-index*', filter: 'labels.groupId: group-3', good: 'latency < 300', total: '', @@ -72,7 +72,7 @@ export const createMetricCustomIndicator = ( ): MetricCustomIndicator => ({ type: 'sli.metric.custom', params: { - index: 'my-index*', + index: 'my-index*,my-other-index*', filter: 'labels.groupId: group-3', good: { metrics: [ @@ -95,7 +95,7 @@ export const createHistogramIndicator = ( ): HistogramIndicator => ({ type: 'sli.histogram.custom', params: { - index: 'my-index*', + index: 'my-index*,my-other-index*', filter: 'labels.groupId: group-3', good: { field: 'latency', diff --git a/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/histogram.test.ts.snap b/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/histogram.test.ts.snap index ba7b00be25841..97850346b4d60 100644 --- a/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/histogram.test.ts.snap +++ b/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/histogram.test.ts.snap @@ -209,7 +209,10 @@ Object { "deduce_mappings": false, }, "source": Object { - "index": "my-index*", + "index": Array [ + "my-index*", + "my-other-index*", + ], "query": Object { "bool": Object { "minimum_should_match": 1, @@ -449,7 +452,10 @@ Object { "deduce_mappings": false, }, "source": Object { - "index": "my-index*", + "index": Array [ + "my-index*", + "my-other-index*", + ], "query": Object { "bool": Object { "minimum_should_match": 1, diff --git a/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/kql_custom.test.ts.snap b/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/kql_custom.test.ts.snap index c9815496cdf46..20c3a00ea9b28 100644 --- a/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/kql_custom.test.ts.snap +++ b/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/kql_custom.test.ts.snap @@ -224,7 +224,10 @@ Object { "deduce_mappings": false, }, "source": Object { - "index": "my-index*", + "index": Array [ + "my-index*", + "my-other-index*", + ], "query": Object { "bool": Object { "minimum_should_match": 1, @@ -438,7 +441,10 @@ Object { "deduce_mappings": false, }, "source": Object { - "index": "my-index*", + "index": Array [ + "my-index*", + "my-other-index*", + ], "query": Object { "bool": Object { "minimum_should_match": 1, diff --git a/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/metric_custom.test.ts.snap b/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/metric_custom.test.ts.snap index 2a4683cd32995..fdd731df983cb 100644 --- a/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/metric_custom.test.ts.snap +++ b/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/metric_custom.test.ts.snap @@ -233,7 +233,10 @@ Object { "deduce_mappings": false, }, "source": Object { - "index": "my-index*", + "index": Array [ + "my-index*", + "my-other-index*", + ], "query": Object { "bool": Object { "minimum_should_match": 1, @@ -485,7 +488,10 @@ Object { "deduce_mappings": false, }, "source": Object { - "index": "my-index*", + "index": Array [ + "my-index*", + "my-other-index*", + ], "query": Object { "bool": Object { "minimum_should_match": 1, diff --git a/x-pack/plugins/observability/server/services/slo/transform_generators/histogram.ts b/x-pack/plugins/observability/server/services/slo/transform_generators/histogram.ts index 7793123ff1595..aef873ed7e973 100644 --- a/x-pack/plugins/observability/server/services/slo/transform_generators/histogram.ts +++ b/x-pack/plugins/observability/server/services/slo/transform_generators/histogram.ts @@ -14,7 +14,7 @@ import { import { InvalidTransformError } from '../../../errors'; import { getSLOTransformTemplate } from '../../../assets/transform_templates/slo_transform_template'; -import { getElastichsearchQueryOrThrow, TransformGenerator } from '.'; +import { getElastichsearchQueryOrThrow, parseIndex, TransformGenerator } from '.'; import { SLO_DESTINATION_INDEX_NAME, SLO_INGEST_PIPELINE_NAME, @@ -47,7 +47,7 @@ export class HistogramTransformGenerator extends TransformGenerator { private buildSource(slo: SLO, indicator: HistogramIndicator) { const filter = getElastichsearchQueryOrThrow(indicator.params.filter); return { - index: indicator.params.index, + index: parseIndex(indicator.params.index), runtime_mappings: this.buildCommonRuntimeMappings(slo), query: filter, }; diff --git a/x-pack/plugins/observability/server/services/slo/transform_generators/kql_custom.ts b/x-pack/plugins/observability/server/services/slo/transform_generators/kql_custom.ts index e44bab97e1b78..1dd162d688eb4 100644 --- a/x-pack/plugins/observability/server/services/slo/transform_generators/kql_custom.ts +++ b/x-pack/plugins/observability/server/services/slo/transform_generators/kql_custom.ts @@ -10,7 +10,7 @@ import { kqlCustomIndicatorSchema, timeslicesBudgetingMethodSchema } from '@kbn/ import { InvalidTransformError } from '../../../errors'; import { getSLOTransformTemplate } from '../../../assets/transform_templates/slo_transform_template'; -import { getElastichsearchQueryOrThrow, TransformGenerator } from '.'; +import { getElastichsearchQueryOrThrow, parseIndex, TransformGenerator } from '.'; import { SLO_DESTINATION_INDEX_NAME, SLO_INGEST_PIPELINE_NAME, @@ -42,7 +42,7 @@ export class KQLCustomTransformGenerator extends TransformGenerator { private buildSource(slo: SLO, indicator: KQLCustomIndicator) { const filter = getElastichsearchQueryOrThrow(indicator.params.filter); return { - index: indicator.params.index, + index: parseIndex(indicator.params.index), runtime_mappings: this.buildCommonRuntimeMappings(slo), query: filter, }; diff --git a/x-pack/plugins/observability/server/services/slo/transform_generators/metric_custom.ts b/x-pack/plugins/observability/server/services/slo/transform_generators/metric_custom.ts index 8faa996272e46..024f4403d9479 100644 --- a/x-pack/plugins/observability/server/services/slo/transform_generators/metric_custom.ts +++ b/x-pack/plugins/observability/server/services/slo/transform_generators/metric_custom.ts @@ -10,7 +10,7 @@ import { metricCustomIndicatorSchema, timeslicesBudgetingMethodSchema } from '@k import { InvalidTransformError } from '../../../errors'; import { getSLOTransformTemplate } from '../../../assets/transform_templates/slo_transform_template'; -import { getElastichsearchQueryOrThrow, TransformGenerator } from '.'; +import { getElastichsearchQueryOrThrow, parseIndex, TransformGenerator } from '.'; import { SLO_DESTINATION_INDEX_NAME, SLO_INGEST_PIPELINE_NAME, @@ -45,7 +45,7 @@ export class MetricCustomTransformGenerator extends TransformGenerator { private buildSource(slo: SLO, indicator: MetricCustomIndicator) { const filter = getElastichsearchQueryOrThrow(indicator.params.filter); return { - index: indicator.params.index, + index: parseIndex(indicator.params.index), runtime_mappings: this.buildCommonRuntimeMappings(slo), query: filter, };