# More then one attached file in to index

**URL:** <https://discuss.elastic.co/t/more-then-one-attached-file-in-to-index/254133>\
**Category:** Elasticsearch\
**Created:** [November 3, 2020, 10:23am UTC](https://discuss.elastic.co/t/more-then-one-attached-file-in-to-index/254133 "2020-11-03T10:23:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucrug](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lucrug/32/78318_2.png) [@lucrug](https://discuss.elastic.co/u/lucrug)\
**Post date:** [November 3, 2020, 10:23am UTC](https://discuss.elastic.co/t/more-then-one-attached-file-in-to-index/254133/1 "2020-11-03T10:23:40Z")

</div>

Hi gays,

can i define more then one attached (RFT) field in a index?  
This example is for one:

```auto
PUT _ingest/pipeline/attachment
{
  "description" : "Extract attachment information",
  "processors" : [
    {
      "attachment" : {
        "field" : "data",
        "indexed_chars" : 11,
        "indexed_chars_field" : "max_size"
      }
    }
  ]
} 

```

**I would like to do such a thing :**

```auto
PUT _ingest/pipeline/attachment
{
  "description" : "Extract attachment information",
  "processors" : [
    {
      "attachment" : {
        "field" : "data1",
        "indexed_chars" : 11,
        "indexed_chars_field" : "max_size"
      },
       {
      "attachment" : {
        "field" : "data2",
        "indexed_chars" : 11,
        "indexed_chars_field" : "max_size"
      },
      {
      "attachment" : {
        "field" : "data3",
        "indexed_chars" : 11,
        "indexed_chars_field" : "max_size"
      }
    }
  ]
} 

```

**feor each field attached to have its own structur :**

```auto
  "attachment": {
       "content_type": "application / rtf",
       "language": "ro",
       "content": "Lorem",
       "content_length": 5
     }

```

It's possible ? If so, how?

---

<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:** [November 3, 2020, 11:28am UTC](https://discuss.elastic.co/t/more-then-one-attached-file-in-to-index/254133/2 "2020-11-03T11:28:38Z")

</div>

I'd use `target_field`. So I'd do something like:

```auto
PUT _ingest/pipeline/attachment
{
  "description" : "Extract attachment information",
  "processors" : [
    {
      "attachment" : {
        "field" : "data1",
        "indexed_chars" : 11,
        "indexed_chars_field" : "max_size",
        "target_field": "attachment1"
      },
       {
      "attachment" : {
        "field" : "data2",
        "indexed_chars" : 11,
        "indexed_chars_field" : "max_size",
        "target_field": "attachment2"
      },
      {
      "attachment" : {
        "field" : "data3",
        "indexed_chars" : 11,
        "indexed_chars_field" : "max_size",
        "target_field": "attachment3"
      }
    }
  ]
} 

```

If I understood correctly the use case.

Also have a look at this:

> **[Using the Attachment Processor with arrays | Elasticsearch Plugins and...](https://www.elastic.co/guide/en/elasticsearch/plugins/7.9/ingest-attachment-with-arrays.html)**

That could help may be?

---

<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:** [December 1, 2020, 11:28am UTC](https://discuss.elastic.co/t/more-then-one-attached-file-in-to-index/254133/3 "2020-12-01T11:28:38Z")

</div>

Closed on December 1, 2020, 11:28am UTC

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