# How can I identify the document which causes java.lang.ClassCastException

**URL:** <https://discuss.elastic.co/t/how-can-i-identify-the-document-which-causes-java-lang-classcastexception/68703>\
**Category:** Elasticsearch\
**Created:** [December 12, 2016, 11:24am UTC](https://discuss.elastic.co/t/how-can-i-identify-the-document-which-causes-java-lang-classcastexception/68703 "2016-12-12T11:24:50Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [December 12, 2016, 12:43pm UTC](https://discuss.elastic.co/t/how-can-i-identify-the-document-which-causes-java-lang-classcastexception/68703/2 "2016-12-12T12:43:12Z")

</div>

Please format your code using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will make your post more readable.

It seems that the mapping has not been processed on every shard in the same manner. IIRC it can happen on old version when 2 requests goes to 2 shards in parallel and updates the mapping at the same time.

This has been fixed in recent version.

I don't know how you can identify this though.

A way to solve the issue in the future, may be send the mapping in advance when you create your index so you are sure it's propagated to all nodes/shards.  
Or upgrade 🙂

---

_[View the full topic](https://discuss.elastic.co/t/how-can-i-identify-the-document-which-causes-java-lang-classcastexception/68703)._
