# Error on index: MapperParsingException: No content is provided

**URL:** <https://discuss.elastic.co/t/error-on-index-mapperparsingexception-no-content-is-provided/58021>\
**Category:** Elasticsearch\
**Created:** [August 15, 2016, 11:28am UTC](https://discuss.elastic.co/t/error-on-index-mapperparsingexception-no-content-is-provided/58021 "2016-08-15T11:28:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulhuisman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paulhuisman/32/11378_2.png) [@paulhuisman](https://discuss.elastic.co/u/paulhuisman)\
**Post date:** [August 15, 2016, 11:28am UTC](https://discuss.elastic.co/t/error-on-index-mapperparsingexception-no-content-is-provided/58021/1 "2016-08-15T11:28:17Z")

</div>

Some of my documents have attachments, some don't. Right now the ones that don't do not get indexed at all.

My mapping is:

> @mapping=  
> {:priref=\>{:type=\>"integer", :index=\>"not\_analyzed"},  
> :title=\>{:type=\>"string"},  
> :publisher=\>{:type=\>"string"},  
> :keywords=\>{:type=\>"string"},  
> :abstract=\>{:type=\>"string"},  
> :digital\_reference=\>{:index=\>"not\_analyzed", :type=\>"string"},  
> :language\_code=\>{:index=\>"not\_analyzed", :type=\>"string"},  
> :year=\>{:type=\>"string"},  
> :material\_type=\>  
> {:analyzer=\>"snowball", :index=\>"not\_analyzed", :type=\>"string"},  
> :theme=\>{:analyzer=\>"snowball", :index=\>"not\_analyzed", :type=\>"string"},  
> :created\_at=\>{:type=\>"date", :index=\>"not\_analyzed"},  
> :updated\_at=\>{:type=\>"date", :index=\>"not\_analyzed"},  
> :authors=\>  
> {:type=\>"object",  
> :properties=\>{:name=\>{:analyzer=\>"snowball", :type=\>"string"}}},  
> :attachment=\>{:type=\>"attachment", :store=\>true}},  
> @options={:\_source=\>{:excludes=\>["attachment"]}},  
> @type="document"\>

A few of my documents do not have an attachment. When indexing i get the following error:  
MapperParsingException: No content is provided

Full error:

> org.elasticsearch.index.mapper.MapperParsingException: No content is provided.  
> at org.elasticsearch.index.mapper.attachment.AttachmentMapper.parse(AttachmentMapper.java:371)  
> at org.elasticsearch.index.mapper.object.ObjectMapper.serializeNullValue(ObjectMapper.java:505)  
> at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:465)  
> at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:515)  
> at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:462)  
> at org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:384)  
> at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:203)  
> at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:556)  
> at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:426)  
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
> at java.lang.Thread.run(Thread.java:745)

How can i make sure the attachment is optional?

I'm using the Mapper attachments plugin and Elasticsearch 1.1.2

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [August 15, 2016, 2:00pm UTC](https://discuss.elastic.co/t/error-on-index-mapperparsingexception-no-content-is-provided/58021/2 "2016-08-15T14:00:24Z")

</div>

As described in this [issue](https://github.com/elastic/elasticsearch-mapper-attachments/issues/23) the content is not optional. What's unclear to my at the moment (and from reading the issue) is what happens if you don't index the field at all (in your case I think thats the "attachment" field?). How do you index your documents?

---

<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:27pm UTC](https://discuss.elastic.co/t/error-on-index-mapperparsingexception-no-content-is-provided/58021/3 "2017-07-05T22:27:46Z")

</div>


