# Unable to create mapping of an index through Java code

**URL:** <https://discuss.elastic.co/t/unable-to-create-mapping-of-an-index-through-java-code/302180>\
**Category:** Elasticsearch\
**Created:** [April 12, 2022, 7:04am UTC](https://discuss.elastic.co/t/unable-to-create-mapping-of-an-index-through-java-code/302180 "2022-04-12T07:04:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Apurba](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@Apurba](https://discuss.elastic.co/u/Apurba)\
**Post date:** [April 12, 2022, 7:04am UTC](https://discuss.elastic.co/t/unable-to-create-mapping-of-an-index-through-java-code/302180/1 "2022-04-12T07:04:50Z")

</div>

I'm trying to create mapping from Java code by **request.mapping(parameter)** and **request.source(parameter)** but every time I'm getting **"Mapper\_parsing\_exception"** , can anyone please help me out if they have any context about that.

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [April 12, 2022, 12:53pm UTC](https://discuss.elastic.co/t/unable-to-create-mapping-of-an-index-through-java-code/302180/2 "2022-04-12T12:53:33Z")

</div>

Hi.  
Can you give more details of the code?

---

<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:** [April 12, 2022, 3:12pm UTC](https://discuss.elastic.co/t/unable-to-create-mapping-of-an-index-through-java-code/302180/3 "2022-04-12T15:12:50Z")

</div>

You need indeed to give the full error message, may be the code you are using and which client it is, with which version?

---

<div class="post-metadata">

**Author:** ![Apurba](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@Apurba](https://discuss.elastic.co/u/Apurba)\
**Post date:** [April 17, 2022, 4:08pm UTC](https://discuss.elastic.co/t/unable-to-create-mapping-of-an-index-through-java-code/302180/4 "2022-04-17T16:08:56Z")

</div>

Hi,  
Sorry for the late reply. I found the error, actually this is a version error I was using old version of Elasticsearch in dependency so I was facing the error, I upgraded it to newer version and the error is resolved.  
Thank you for your responses.

---

<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:** [May 15, 2022, 4:09pm UTC](https://discuss.elastic.co/t/unable-to-create-mapping-of-an-index-through-java-code/302180/5 "2022-05-15T16:09:53Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
