String vs attachment

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

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:

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 instead.