# ES 2.0 and attachments plugin issue

**URL:** <https://discuss.elastic.co/t/es-2-0-and-attachments-plugin-issue/34578>\
**Category:** Elasticsearch\
**Created:** [November 14, 2015, 3:13am UTC](https://discuss.elastic.co/t/es-2-0-and-attachments-plugin-issue/34578 "2015-11-14T03:13:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![twigbranch](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@twigbranch](https://discuss.elastic.co/u/twigbranch)\
**Post date:** [November 14, 2015, 3:13am UTC](https://discuss.elastic.co/t/es-2-0-and-attachments-plugin-issue/34578/1 "2015-11-14T03:13:57Z")

</div>

It used to be that this would work:

```
{
"file" : {
    "properties" : {
        "attachment" : {  
            "type" : "attachment",
            "path" : "full",
            "fields": {
                "attachment": {
                    "type": "string",
                    "term_vector": "with_positions_offsets",
                    "store": true
                }
            }
        }
    }
}

```

But since upgrading to ES 2.0 from 1.5.2, when trying to create the index, I get the following error:  
MapperParsingException[Mapping definition for [fields] has unsupported parameters: [attachment : {type=string}]];

The current README for the plugin shows under 'fields' instead of 'attachment' (or whatever you name your attachment) you need to use 'content'.

You also have to change everywhere you refer to the attachment.

1. What caused this change? Was this intentional?

2. Before this change, it seemed that the entire attachments was stored and accessible via 'attachment' as the only field name. What was going on? Was the content being mapped to the name 'attachment' so you wouldn't need to reference it by 'attachment.content'?

---

<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 14, 2015, 4:49am UTC](https://discuss.elastic.co/t/es-2-0-and-attachments-plugin-issue/34578/2 "2015-11-14T04:49:13Z")

</div>

Yes. It changed.  
Read this commit: [https://github.com/elastic/elasticsearch-mapper-attachments/commit/765afb655ed4051371bf9177c13a5888405747bd](https://github.com/elastic/elasticsearch-mapper-attachments/commit/765afb655ed4051371bf9177c13a5888405747bd)

---

<div class="post-metadata">

**Author:** ![twigbranch](https://avatars.discourse-cdn.com/v4/letter/t/2bfe46/32.png) [@twigbranch](https://discuss.elastic.co/u/twigbranch)\
**Post date:** [November 14, 2015, 6:54am UTC](https://discuss.elastic.co/t/es-2-0-and-attachments-plugin-issue/34578/3 "2015-11-14T06:54:57Z")

</div>

OK, thanks.

1. So before the change it was possible to exclude the attachment ('attachment' in the example above) from \_source (to avoid storing the binary encoded content), but then later access it by adding it to 'fields' in a search (i.e. fields: ['attachment']). Now, should 'attachment.content' be added to 'excludes' and 'attachment.content' added to 'fields'?

2. Can the whole 'attachment' instead be stored along with its sub fields, and then included in 'excludes' and 'fields'?

---

<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 14, 2015, 7:36am UTC](https://discuss.elastic.co/t/es-2-0-and-attachments-plugin-issue/34578/4 "2015-11-14T07:36:13Z")

</div>

I think that you can still exclude the attachment from the \_source field.  
But you won't be able to get it back then.

But read the \_source documentation. It's not recommended.

If you are coding in Java, I'd recommend not using this plugin but Tika in your application. This is what I did in fscrawler project.

---

<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:** [July 5, 2017, 11:38pm UTC](https://discuss.elastic.co/t/es-2-0-and-attachments-plugin-issue/34578/5 "2017-07-05T23:38:30Z")

</div>


