Skip to content

Commit aaee222

Browse files
authored
[ML] Add hint about using input_output in the inference processor to error message (#129864)
1 parent 788e18f commit aaee222

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

x-pack/plugin/ml/qa/ml-inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/CoordinatedInferenceIngestIT.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ public void testPipelineConfiguredWithFieldMap() throws IOException {
150150
var responseMap = simulatePipeline(ExampleModels.nlpModelPipelineDefinitionWithFieldMap(inferenceServiceModelId), docs);
151151
var simulatedDocs = (List<Map<String, Object>>) responseMap.get("docs");
152152
var errorMsg = (String) MapHelper.dig("error.reason", simulatedDocs.get(0));
153-
assertThat(errorMsg, containsString("[is_model] is configured for the _inference API and does not accept documents as input"));
153+
var expectedMessage = "[is_model] is configured for the _inference API and does not accept documents as input. "
154+
+ "If using an inference ingest processor configure it with the [input_output] option instead of [field_map].";
155+
assertThat(errorMsg, containsString(expectedMessage));
154156
assertThat(simulatedDocs, hasSize(2));
155157
}
156158

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportCoordinatedInferenceAction.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,11 @@ private ActionListener<InferModelAction.Response> wrapCheckForServiceModelOnMiss
190190
ActionListener.wrap(
191191
model -> listener.onFailure(
192192
new ElasticsearchStatusException(
193-
"[" + modelId + "] is configured for the _inference API and does not accept documents as input",
193+
"["
194+
+ modelId
195+
+ "] is configured for the _inference API and does not accept documents as input. "
196+
+ "If using an inference ingest processor configure it with the [input_output] option instead of "
197+
+ "[field_map].",
194198
RestStatus.BAD_REQUEST
195199
)
196200
),

0 commit comments

Comments
 (0)