# Mapper attachment plugin fails to index document

**URL:** <https://discuss.elastic.co/t/mapper-attachment-plugin-fails-to-index-document/26115>\
**Category:** Elasticsearch\
**Created:** [July 22, 2015, 9:37pm UTC](https://discuss.elastic.co/t/mapper-attachment-plugin-fails-to-index-document/26115 "2015-07-22T21:37:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AkshataNaik](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@AkshataNaik](https://discuss.elastic.co/u/AkshataNaik)\
**Post date:** [July 22, 2015, 9:37pm UTC](https://discuss.elastic.co/t/mapper-attachment-plugin-fails-to-index-document/26115/1 "2015-07-22T21:37:50Z")

</div>

Hello,

I am using mapper attachment plugin to index pdf documents. I followed both official documentation : [https://github.com/elastic/elasticsearch-mapper-attachments](https://github.com/elastic/elasticsearch-mapper-attachments) and this example tutorial : [http://www.elasticsearch.cn/tutorials/2011/07/18/attachment-type-in-action.html](http://www.elasticsearch.cn/tutorials/2011/07/18/attachment-type-in-action.html) but although mapping is created indexing fails.

My mapping looks like this: curl -XGET "localhost:9200/help/\_mappings?pretty"  
{  
"help" : {  
"mappings" : {  
"attachment" : {  
"properties" : {  
"file" : {  
"type" : "attachment",  
"path" : "full",  
"fields" : {  
"file" : {  
"type" : "string",  
"store" : true,  
"term\_vector" : "with\_positions\_offsets"  
},  
"author" : {  
"type" : "string"  
},  
"title" : {  
"type" : "string",  
"store" : true  
},  
"name" : {  
"type" : "string"  
},  
"date" : {  
"type" : "date",  
"format" : "dateOptionalTime"  
},  
"keywords" : {  
"type" : "string"  
},  
"content\_type" : {  
"type" : "string",  
"store" : true  
},  
"content\_length" : {  
"type" : "integer"  
},  
"language" : {  
"type" : "string"  
}  
}  
}  
}  
}  
}  
}  
}

The data is converted to base64 format and stored in data64. I post using this command which fails:  
curl -X POST "localhost:9200/msm\_help/attachment/" -d @data64  
The error is:  
{"error":"MapperParsingException[failed to parse]; nested: NoClassDefFoundError[org/apache/tika/metadata/Metadata]; ","status":400}

Without the altering the default mapping the document is indexed but does not yeild any results. When I follow the instructions it fails to index. I am not sure where I am going wrong.

Please help!

---

<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:** [July 23, 2015, 1:08am UTC](https://discuss.elastic.co/t/mapper-attachment-plugin-fails-to-index-document/26115/2 "2015-07-23T01:08:34Z")

</div>

Could you share:

- how you installed the plugin (exact commands please)
- your BASE64 encoded content

Thanks

---

<div class="post-metadata">

**Author:** ![AkshataNaik](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@AkshataNaik](https://discuss.elastic.co/u/AkshataNaik)\
**Post date:** [July 29, 2015, 10:05pm UTC](https://discuss.elastic.co/t/mapper-attachment-plugin-fails-to-index-document/26115/3 "2015-07-29T22:05:35Z")

</div>

Hi david, it seems to work now. I had to keep the field name as just "file" and it worked. I am not sure though.

"file" : {  
"type" : "attachment",  
"path" : "full",  
"fields" : {  
"file" : {  
"type" : "string",  
"store" : true,  
"term\_vector" : "with\_positions\_offsets"  
},

This had to be "file" only. And I dont know why it would not take other names.

---

<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:** [July 30, 2015, 12:08am UTC](https://discuss.elastic.co/t/mapper-attachment-plugin-fails-to-index-document/26115/4 "2015-07-30T00:08:44Z")

</div>

It has to be the same name as the attachement field name.

---

<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:58pm UTC](https://discuss.elastic.co/t/mapper-attachment-plugin-fails-to-index-document/26115/5 "2017-07-05T23:58:14Z")

</div>


