[ML] Add hint about using input_output in the inference processor to error message (#129864)

This commit is contained in:
David Kyle 2025-06-24 12:45:18 +01:00 committed by GitHub
parent 788e18f4d2
commit aaee222dfa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View file

@ -150,7 +150,9 @@ public class CoordinatedInferenceIngestIT extends InferenceBaseRestTest {
var responseMap = simulatePipeline(ExampleModels.nlpModelPipelineDefinitionWithFieldMap(inferenceServiceModelId), docs); var responseMap = simulatePipeline(ExampleModels.nlpModelPipelineDefinitionWithFieldMap(inferenceServiceModelId), docs);
var simulatedDocs = (List<Map<String, Object>>) responseMap.get("docs"); var simulatedDocs = (List<Map<String, Object>>) responseMap.get("docs");
var errorMsg = (String) MapHelper.dig("error.reason", simulatedDocs.get(0)); 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)); assertThat(simulatedDocs, hasSize(2));
} }

View file

@ -190,7 +190,11 @@ public class TransportCoordinatedInferenceAction extends HandledTransportAction<
ActionListener.wrap( ActionListener.wrap(
model -> listener.onFailure( model -> listener.onFailure(
new ElasticsearchStatusException( 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 RestStatus.BAD_REQUEST
) )
), ),