# TransportClient: InvalidTypeNameException prepareCreate addMapping

**URL:** <https://discuss.elastic.co/t/transportclient-invalidtypenameexception-preparecreate-addmapping/125487>\
**Category:** Elasticsearch\
**Created:** [March 25, 2018, 1:39pm UTC](https://discuss.elastic.co/t/transportclient-invalidtypenameexception-preparecreate-addmapping/125487 "2018-03-25T13:39:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joseph\_Peruzzi](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@Joseph\_Peruzzi](https://discuss.elastic.co/u/Joseph_Peruzzi)\
**Post date:** [March 25, 2018, 1:39pm UTC](https://discuss.elastic.co/t/transportclient-invalidtypenameexception-preparecreate-addmapping/125487/1 "2018-03-25T13:39:39Z")

</div>

I'm attempting to work with the JAVA API to create mapping types and I'm following the Java API documentation for managing indices ([https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-admin-indices.html](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-admin-indices.html)). I have valid JSON and if I copy and paste the JSON into Kibana and manually add the mapping it creates without issue.

Following the section "The PUT mapping API allows you to add a new type while creating an index:" in the docs I get the error "Type name too long" because its trying to parse the entire JSON string as the type name.

I created a bug report but wanted to see if I'm just doing this wrong:

> <https://github.com/elastic/elasticsearch/issues/29237>

---

<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:** [April 22, 2018, 1:39pm UTC](https://discuss.elastic.co/t/transportclient-invalidtypenameexception-preparecreate-addmapping/125487/2 "2018-04-22T13:39:43Z")

</div>

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