# Getting an error when setting include\_type\_name to True

**URL:** <https://discuss.elastic.co/t/getting-an-error-when-setting-include-type-name-to-true/221214>\
**Category:** APM\
**Tags:** python\
**Created:** [February 27, 2020, 11:11am UTC](https://discuss.elastic.co/t/getting-an-error-when-setting-include-type-name-to-true/221214 "2020-02-27T11:11:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kristin](https://avatars.discourse-cdn.com/v4/letter/k/2bfe46/32.png) [@kristin](https://discuss.elastic.co/u/kristin)\
**Post date:** [February 27, 2020, 11:11am UTC](https://discuss.elastic.co/t/getting-an-error-when-setting-include-type-name-to-true/221214/1 "2020-02-27T11:11:52Z")

</div>

Hi,

I use a Python script to create an index. For certain reasons, I need it to work on both Elasticsearch 6 and 7, so I want to set include\_type\_name. I have this line of code:

```
response = es.indices.create(index=index, body=body, include_type_name=True)

```

However, I keep getting this error:  
elasticsearch.exceptions.TransportError: TransportError(500, 'class\_cast\_exception', "class java.util.ArrayList cannot be cast to class java.util.Map (java.util.ArrayList and java.util.Map are in module java.base of loader 'bootstrap')")

When I set it to false, it creates the index normally. Any idea why this might be happening?

---

<div class="post-metadata">

**Author:** ![beniwohli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/beniwohli/32/21256_2.png) [@beniwohli](https://discuss.elastic.co/u/beniwohli)\
**Post date:** [February 27, 2020, 12:53pm UTC](https://discuss.elastic.co/t/getting-an-error-when-setting-include-type-name-to-true/221214/2 "2020-02-27T12:53:31Z")

</div>

Hi @kristin

is this happening only when using the Python APM agent? I'm asking because you opened this topic in the APM category of our forum. If the problem is not related to APM, I can move it to the Elasticsearch category, which is better suited to help you with Elasticsearch client questions.

Cheers  
Beni

---

<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:** [March 19, 2020, 8:53am UTC](https://discuss.elastic.co/t/getting-an-error-when-setting-include-type-name-to-true/221214/3 "2020-03-19T08:53:46Z")

</div>

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