# Pipeline attachment - multiple doc

**URL:** <https://discuss.elastic.co/t/pipeline-attachment-multiple-doc/369345>\
**Category:** Elastic Search\
**Created:** [October 24, 2024, 10:03am UTC](https://discuss.elastic.co/t/pipeline-attachment-multiple-doc/369345 "2024-10-24T10:03:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mire](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Mire](https://discuss.elastic.co/u/Mire)\
**Post date:** [October 24, 2024, 10:03am UTC](https://discuss.elastic.co/t/pipeline-attachment-multiple-doc/369345/1 "2024-10-24T10:03:47Z")

</div>

Hi there, im trying to post multiple attachments for index. Same example we have on official. This is my mapping:

```auto
PUT _ingest/pipeline/attachment
{
  "description" : "Extract attachment information from arrays",
  "processors" : [
    {
      "foreach": {
        "field": "attachments",
        "processor": {
          "attachment": {
            "target_field": "_ingest._value.attachment",
            "field": "_ingest._value.data"
          }
        }
      }
    }
  ]
}

```

This is a main body:

```auto
{
  "attachments" : [
    {
      "filename" : "ipsum.txt",
      "data" : "dGhpcyBpcwpqdXN0IHNvbWUgdGV4dAo="
    },
    {
      "filename" : "test.txt",
      "data" : "VGhpcyBpcyBhIHRlc3QK"
    }
  ]
}

```

Im getting response:

```auto
{
    "error": {
        "root_cause": [
            {
                "type": "mapper_parsing_exception",
                "reason": "failed to parse field [attachments] of type [text] in document with id '203'. Preview of field's value: '{filename=ipsum.txt, data=dGhpcyBpcwpqdXN0IHNvbWUgdGV4dAo=, attachment={content_type=text/plain; charset=ISO-8859-1, language=en, content=this is\njust some text, content_length=24}}'"
            }
        ],
        "type": "mapper_parsing_exception",
        "reason": "failed to parse field [attachments] of type [text] in document with id '203'. Preview of field's value: '{filename=ipsum.txt, data=dGhpcyBpcwpqdXN0IHNvbWUgdGV4dAo=, attachment={content_type=text/plain; charset=ISO-8859-1, language=en, content=this is\njust some text, content_length=24}}'",
        "caused_by": {
            "type": "illegal_state_exception",
            "reason": "Can't get text on a START_OBJECT at 1:17"
        }
    },
    "status": 400
}

```

I would apprechiate any suggestion on, what's wrong here, i guess mapping should be changed, but not sure (new to elastic).  
Thanks

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 24, 2024, 10:25am UTC](https://discuss.elastic.co/t/pipeline-attachment-multiple-doc/369345/2 "2024-10-24T10:25:35Z")

</div>

Welcome!

I guess you are calling the PUT/POST `_doc` API, right?

What is the mapping of your index?

---

<div class="post-metadata">

**Author:** ![Mire](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Mire](https://discuss.elastic.co/u/Mire)\
**Post date:** [October 24, 2024, 10:49am UTC](https://discuss.elastic.co/t/pipeline-attachment-multiple-doc/369345/3 "2024-10-24T10:49:07Z")

</div>

Yes, im calling put/post \_doc api.

This is mapping of my index:

```auto
{
    "idx_project": {
        "mappings": {
            "properties": {
                "acl_key": {
                    "type": "long"
                },
                "active": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "application": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "centers": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "code": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "confidentiality": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "control_group": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "creator": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "test_platform": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "html_description": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "icon": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "id": {
                    "type": "long"
                },
                "internal_id": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "link_id": {
                    "type": "long"
                },
                "family": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "name": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "object_text": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "operators": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "page": {
                    "type": "long"
                },
                "project": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "purpose": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "status": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "study": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "teams": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "title": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                }
            }
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![Mire](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Mire](https://discuss.elastic.co/u/Mire)\
**Post date:** [October 24, 2024, 10:58am UTC](https://discuss.elastic.co/t/pipeline-attachment-multiple-doc/369345/4 "2024-10-24T10:58:06Z")

</div>

I got it work after i've deleted and created index again. Probably because of old updated mapping was incorrect.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 21, 2024, 10:59am UTC](https://discuss.elastic.co/t/pipeline-attachment-multiple-doc/369345/5 "2024-11-21T10:59:03Z")

</div>

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