# String vs attachment

**URL:** <https://discuss.elastic.co/t/string-vs-attachment/63347>\
**Category:** Elasticsearch\
**Created:** [October 19, 2016, 7:02am UTC](https://discuss.elastic.co/t/string-vs-attachment/63347 "2016-10-19T07:02:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![valerioorfano](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@valerioorfano](https://discuss.elastic.co/u/valerioorfano)\
**Post date:** [October 19, 2016, 7:02am UTC](https://discuss.elastic.co/t/string-vs-attachment/63347/1 "2016-10-19T07:02:32Z")

</div>

Hi There!

what is the difference between a field of type "attachment" and a field of type "string"in ES ? Is it just the max lenght allowable? I m wondering if it is worthy using a field of type attachment insted of one of type string.

Rgds valerio

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [October 19, 2016, 8:22am UTC](https://discuss.elastic.co/t/string-vs-attachment/63347/2 "2016-10-19T08:22:22Z")

</div>

Hi @valerioorfano,

`string` is a standard data type supported by Elasticsearch whereas "attachment" is a data type that is added by the mapper-attachment-plugin. Citing from the [docs](https://www.elastic.co/guide/en/elasticsearch/plugins/2.4/mapper-attachments-usage.html):

> The attachment type not only indexes the content of the doc in content sub field, but also automatically adds meta data on the attachment as well (when available).

So, it's basically more structured than just a single string field. Please also note that the mapper-attachment-plugin is deprecated in the upcoming version Elasticsearch 5.0 and you should use the [ingest attachment plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/5.0/ingest-attachment.html) instead.

Daniel

---

<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, 10:11pm UTC](https://discuss.elastic.co/t/string-vs-attachment/63347/3 "2017-07-05T22:11:23Z")

</div>

Closed on July 5, 2017, 10:11pm UTC


