Ingest attachment in nested type

Hi,
I'm trying to index multiple documents in nested type using ingest attachment plugin.
Simply I create my pipeline as follow:

{
    "description": "Extract attachment information",
    "processors": [
        {
            "foreach": {
                "field": "data",
                "processor": {
                  "attachment": {
                    "field": "_ingest._value",
                    "ignore_failure" : true
                  }
                }
            }
        }
    ]
}

Then I index my document as follow:

PUT /test_ingest/_doc/1?pipeline=attachment
{
  "data": ["e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0=", "Y2lhb25lZWUhCg=="]
}

But as result I get:

"_source" : {
    "data" : [
      "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0=",
      "dGVzdCEK"
    ],
    "attachment" : {
      "content_type" : "text/plain; charset=ISO-8859-1",
      "language" : "et",
      "content" : "test!",
      "content_length" : 7
    }
  }

Instead of getting an array of attachments.
I also tried to create a mapping as follow:

"attachments": {
    "type": "nested",
    "properties": {
        "content_type": {
            "type": "keyword"
        },
        "language": {
            "type": "keyword"
        },
        "content": {
            "type": "text"
        },
        "content_length": {
            "type": "integer"
        }
    }
}

and specify the target field in my pipeline:

{
    "description": "Extract attachment information",
    "processors": [
        {
            "foreach": {
                "field": "data",
                "processor": {
                  "attachment": {
                    "field": "_ingest._value",
                    "target_field": "attachments",
                    "ignore_failure" : true
                  }
                }
            }
        }
    ]
}

Unluckily I don't have any success. I also try to simulate the pipeline and it gives as result only one attachment instead of an array as expected by using foreach processor.

Any suggestions?

Did you see https://www.elastic.co/guide/en/elasticsearch/plugins/7.6/ingest-attachment-with-arrays.html ?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.