You can't add your own subfields to the attachment field. Though this should be doable but requires some work IMO.
Also, I think you need to use nested documents. And add whatever field you want in the nested doc (type, id...) and add the attachment field as well. HTH -- David ;-) Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs Le 27 août 2014 à 18:27, sekharreddy mandapati <sekhar4...@gmail.com> a écrit : We have requirement of indexing email which have multiple attachments and we have to highlight the search results. How can i map the highlight string array to my multiple attachments. My index mapping is { "document":{ "properties":{ "attachmentContent":{ "type":"attachment", "path":"full", "fields":{ "attachmentContent":{ "type":"string", "term_vector":"with_positions_offsets", "store":true } } } } } } My indexed document is {"userId":2,"attachmentContent":[{"content":"VGhpcyBpcyBudW1iZXIgb25lLg==","serviceAttachmentId":"1","fileName":"1.txt","type":"xml"}, { {"content":"IkdvZCBTYXZlIHRoZSBRdWVlbiIgKGFsdGVybmF0aXZlbHkgIkdvZCBTYXZlIHRoZSBLaW5nIg==","serviceAttachmentId":"2","fileName":"2.txt","type":"excel"}] } My Questions are 1.How can i access the "serviceAttachmentId" inside the "attachmentContent" field which is of type attachment. 2.How can i filter the documents based on type. -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1c34c96f-c28f-4d4f-8c09-970160f9e669%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/D5451799-32E1-484D-9F78-F016CEA172FB%40pilato.fr. For more options, visit https://groups.google.com/d/optout.