# How to set include\_type\_name to be true or false by Java rest High client APM

**URL:** <https://discuss.elastic.co/t/how-to-set-include-type-name-to-be-true-or-false-by-java-rest-high-client-apm/270365>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [April 16, 2021, 9:25am UTC](https://discuss.elastic.co/t/how-to-set-include-type-name-to-be-true-or-false-by-java-rest-high-client-apm/270365 "2021-04-16T09:25:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SomberOfShadow](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/somberofshadow/32/87168_2.png) [@SomberOfShadow](https://discuss.elastic.co/u/SomberOfShadow)\
**Post date:** [April 16, 2021, 9:25am UTC](https://discuss.elastic.co/t/how-to-set-include-type-name-to-be-true-or-false-by-java-rest-high-client-apm/270365/1 "2021-04-16T09:25:50Z")

</div>

How to set include\_type\_name to be true or false by Java rest High client APM in order to solve follwing issue :  
Elasticsearch error: Types cannot be provided in get mapping requests, unless include\_type\_name is set to true.

Thanks a lot !

---

<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 16, 2021, 4:37pm UTC](https://discuss.elastic.co/t/how-to-set-include-type-name-to-be-true-or-false-by-java-rest-high-client-apm/270365/2 "2021-04-16T16:37:14Z")

</div>

You can't. If you want to do that, you can only use the low level client.

---

<div class="post-metadata">

**Author:** ![SomberOfShadow](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/somberofshadow/32/87168_2.png) [@SomberOfShadow](https://discuss.elastic.co/u/SomberOfShadow)\
**Post date:** [April 19, 2021, 1:56am UTC](https://discuss.elastic.co/t/how-to-set-include-type-name-to-be-true-or-false-by-java-rest-high-client-apm/270365/3 "2021-04-19T01:56:59Z")

</div>

I found Restful API and python API to set "include\_type\_name".

Restful API:

```auto
PUT /send-mje-version-size-test4?include_type_name=true
{
  "mappings": {
    "_doc": {          
      "properties": {
        "lastModified": { 
		        "type": "text"		
        },
        "mjeVersion": {   
            "type": "text"
        },
	     	"sizeOnDisk": {   
            "type": "long"
        }
      }
    }
  }
}

```

Python API:

`es.indices.create(index=indexName, include_type_name=True) `  
or  
`es.indices.put_mapping(index=indexName, body=mappings, include_type_name=True)`

BRs//Hengtai

---

<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 17, 2021, 1:57am UTC](https://discuss.elastic.co/t/how-to-set-include-type-name-to-be-true-or-false-by-java-rest-high-client-apm/270365/4 "2021-05-17T01:57:26Z")

</div>

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