From aaee222dfa35538fe15a31c7ff593166a7e0397f Mon Sep 17 00:00:00 2001 From: David Kyle Date: Tue, 24 Jun 2025 12:45:18 +0100 Subject: [PATCH] [ML] Add hint about using input_output in the inference processor to error message (#129864) --- .../xpack/ml/integration/CoordinatedInferenceIngestIT.java | 4 +++- .../ml/action/TransportCoordinatedInferenceAction.java | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/ml/qa/ml-inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/CoordinatedInferenceIngestIT.java b/x-pack/plugin/ml/qa/ml-inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/CoordinatedInferenceIngestIT.java index 058b64894f8b..ac26a48ce68e 100644 --- a/x-pack/plugin/ml/qa/ml-inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/CoordinatedInferenceIngestIT.java +++ b/x-pack/plugin/ml/qa/ml-inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/CoordinatedInferenceIngestIT.java @@ -150,7 +150,9 @@ public class CoordinatedInferenceIngestIT extends InferenceBaseRestTest { var responseMap = simulatePipeline(ExampleModels.nlpModelPipelineDefinitionWithFieldMap(inferenceServiceModelId), docs); var simulatedDocs = (List>) responseMap.get("docs"); var errorMsg = (String) MapHelper.dig("error.reason", simulatedDocs.get(0)); - assertThat(errorMsg, containsString("[is_model] is configured for the _inference API and does not accept documents as input")); + var expectedMessage = "[is_model] is configured for the _inference API and does not accept documents as input. " + + "If using an inference ingest processor configure it with the [input_output] option instead of [field_map]."; + assertThat(errorMsg, containsString(expectedMessage)); assertThat(simulatedDocs, hasSize(2)); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportCoordinatedInferenceAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportCoordinatedInferenceAction.java index a3ad59644772..774c2849d57d 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportCoordinatedInferenceAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportCoordinatedInferenceAction.java @@ -190,7 +190,11 @@ public class TransportCoordinatedInferenceAction extends HandledTransportAction< ActionListener.wrap( model -> listener.onFailure( new ElasticsearchStatusException( - "[" + modelId + "] is configured for the _inference API and does not accept documents as input", + "[" + + modelId + + "] is configured for the _inference API and does not accept documents as input. " + + "If using an inference ingest processor configure it with the [input_output] option instead of " + + "[field_map].", RestStatus.BAD_REQUEST ) ),