Enterprise Search: Include field name in ingest pipeline inference error (#160248)

We can end up with with seemingly duplicate errors:

```
        "_source": {
          "_ingest": {
            "inference_errors": [
              {
                "message": "Processor 'inference' in pipeline 'test' failed with message 'Trained model deployment [.elser_model_1] is not allocated to any nodes'"
              },
              {
                "message": "Processor 'inference' in pipeline 'body-content' failed with message 'Trained model deployment [.elser_model_1] is not allocated to any nodes'"
              },
              {
                "message": "Processor 'inference' in pipeline 'body-content' failed with message 'Trained model deployment [.elser_model_1] is not allocated to any nodes'"
              }
            ]
          }
        }
      },
```

This adds the field name in the error message for easier
differentiation.
It also includes `allow_duplicates: false` in the append processor, to
make sure we are not adding duplicate error messages to
`inference_errors`.
This commit is contained in:
Ioana Tagirta 2023-06-22 15:32:20 +02:00 committed by GitHub
parent 5fb9709d4c
commit da745c3083
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View file

@ -154,10 +154,11 @@ describe('generateMlInferencePipelineBody lib function', () => {
{
append: {
field: '_source._ingest.inference_errors',
allow_duplicates: false,
value: [
{
message:
"Processor 'inference' in pipeline 'my-pipeline' failed with message '{{ _ingest.on_failure_message }}'",
"Processor 'inference' in pipeline 'my-pipeline' failed for field 'my-source-field' with message '{{ _ingest.on_failure_message }}'",
pipeline: 'my-pipeline',
timestamp: '{{{ _ingest.timestamp }}}',
},

View file

@ -133,9 +133,10 @@ export const getInferenceProcessor = (
{
append: {
field: '_source._ingest.inference_errors',
allow_duplicates: false,
value: [
{
message: `Processor 'inference' in pipeline '${pipelineName}' failed with message '{{ _ingest.on_failure_message }}'`,
message: `Processor 'inference' in pipeline '${pipelineName}' failed for field '${sourceField}' with message '{{ _ingest.on_failure_message }}'`,
pipeline: pipelineName,
timestamp: '{{{ _ingest.timestamp }}}',
},

View file

@ -62,10 +62,11 @@ describe('formatMlPipelineBody util function', () => {
{
append: {
field: '_source._ingest.inference_errors',
allow_duplicates: false,
value: [
{
pipeline: pipelineName,
message: `Processor 'inference' in pipeline '${pipelineName}' failed with message '{{ _ingest.on_failure_message }}'`,
message: `Processor 'inference' in pipeline '${pipelineName}' failed for field '${sourceField}' with message '{{ _ingest.on_failure_message }}'`,
timestamp: '{{{ _ingest.timestamp }}}',
},
],