Skip to content

Commit 99bfd39

Browse files
authored
[Streams] Fix detected fields mapping simulation and ignored fields message (#237474)
## 📓 Summary Closes #236485 Closes #237024 - Remove the manual addition of existing mappings to the ingest simulation performed when testing processing changes in streams, as this was recently fixed on the Elasticsearch side. - Update message feedback about ignored fields with some more context.
1 parent 202b513 commit 99bfd39

File tree

2 files changed

+27
-32
lines changed
  • x-pack/platform/plugins/shared

2 files changed

+27
-32
lines changed

x-pack/platform/plugins/shared/streams/server/routes/internal/streams/processing/simulation_handler.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ const prepareIngestSimulationBody = (
305305
const { docs, processors } = simulationData;
306306

307307
const defaultPipelineName = streamIndex.settings?.index?.default_pipeline;
308-
const mappings = streamIndex.mappings;
309308

310309
const pipelineSubstitutions: SimulateIngestRequest['pipeline_substitutions'] = {};
311310

@@ -336,13 +335,11 @@ const prepareIngestSimulationBody = (
336335
// But the ingest simulation API does not validate correctly the mappings unless they are specified in the simulation body.
337336
// So we need to merge the mappings from the stream index with the detected fields.
338337
// This is a workaround until the ingest simulation API works as expected.
339-
mapping_addition: {
340-
...mappings,
341-
properties: {
342-
...(mappings && mappings.properties),
343-
...(detected_fields && computeMappingProperties(detected_fields)),
338+
...(detected_fields && {
339+
mapping_addition: {
340+
properties: computeMappingProperties(detected_fields),
344341
},
345-
},
342+
}),
346343
};
347344

348345
return simulationBody;

x-pack/platform/plugins/shared/streams_app/public/components/data_management/stream_detail_enrichment/page_content.tsx

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ import React, { useMemo } from 'react';
99
import {
1010
EuiAccordion,
1111
EuiCode,
12-
EuiFlexGroup,
1312
EuiPanel,
1413
EuiResizableContainer,
1514
EuiSplitPanel,
1615
EuiText,
17-
useEuiTheme,
1816
} from '@elastic/eui';
1917
import { i18n } from '@kbn/i18n';
2018
import type { Streams } from '@kbn/streams-schema';
@@ -184,8 +182,6 @@ export function StreamDetailEnrichmentContentImpl() {
184182
}
185183

186184
const StepsEditor = React.memo(() => {
187-
const { euiTheme } = useEuiTheme();
188-
189185
const stepRefs = useStreamEnrichmentSelector((state) => state.context.stepRefs);
190186

191187
const simulation = useSimulatorSelector((snapshot) => snapshot.context.simulation);
@@ -234,40 +230,42 @@ const StepsEditor = React.memo(() => {
234230
<strong>
235231
{i18n.translate(
236232
'xpack.streams.streamDetailView.managementTab.enrichment.ignoredFieldsFailure.title',
237-
{ defaultMessage: 'Some fields were ignored during the simulation.' }
233+
{ defaultMessage: 'Malformed fields detected.' }
238234
)}
239235
</strong>
240236
}
241237
>
242238
<EuiText component="p" size="s">
239+
<p>
240+
<FormattedMessage
241+
id="xpack.streams.streamDetailView.managementTab.enrichment.ignoredFieldsFailure.fieldsList"
242+
defaultMessage="Some fields are malformed and won’t be stored correctly: {fields}"
243+
values={{
244+
fields: errors.ignoredFields.map((field) => (
245+
<>
246+
<EuiCode key={field}>{field}</EuiCode>{' '}
247+
</>
248+
)),
249+
}}
250+
/>
251+
</p>
243252
<p>
244253
{i18n.translate(
245-
'xpack.streams.streamDetailView.managementTab.enrichment.ignoredFieldsFailure.description',
254+
'xpack.streams.streamDetailView.managementTab.enrichment.ignoredFieldsFailure.causesLabel',
246255
{
247256
defaultMessage:
248-
'Some fields in these documents were ignored during the ingestion simulation. Review the fields’ mapping limits.',
257+
'This can happen due to type mismatches or fields exceeding configured limits.',
249258
}
250259
)}
251260
</p>
252261
<p>
253-
<FormattedMessage
254-
id="xpack.streams.streamDetailView.managementTab.enrichment.ignoredFieldsFailure.fieldsList"
255-
defaultMessage="The ignored fields are: {fields}"
256-
values={{
257-
fields: (
258-
<EuiFlexGroup
259-
gutterSize="s"
260-
css={css`
261-
margin-top: ${euiTheme.size.s};
262-
`}
263-
>
264-
{errors.ignoredFields.map((field) => (
265-
<EuiCode key={field}>{field}</EuiCode>
266-
))}
267-
</EuiFlexGroup>
268-
),
269-
}}
270-
/>
262+
{i18n.translate(
263+
'xpack.streams.streamDetailView.managementTab.enrichment.ignoredFieldsFailure.suggestionsLabel',
264+
{
265+
defaultMessage:
266+
'Check your field mappings, add processors to normalize values, or remove the conflicting fields.',
267+
}
268+
)}
271269
</p>
272270
</EuiText>
273271
</EuiAccordion>

0 commit comments

Comments
 (0)