# How to set include\_type\_name HLClient GetIndexTemplatesRequest() or GetIndexRequest()

**URL:** https://discuss.elastic.co/t/how-to-set-include-type-name-hlclient-getindextemplatesrequest-or-getindexrequest/232498
**Category:** Elasticsearch
**Created:** [May 13, 2020, 6:51pm UTC](https://discuss.elastic.co/t/how-to-set-include-type-name-hlclient-getindextemplatesrequest-or-getindexrequest/232498 "2020-05-13T18:51:31Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Cat](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@Cat](https://discuss.elastic.co/u/Cat)
#### Post date: [May 13, 2020, 6:51pm UTC](https://discuss.elastic.co/t/how-to-set-include-type-name-hlclient-getindextemplatesrequest-or-getindexrequest/232498/1 "2020-05-13T18:51:31Z")

</div>

I've tried both GetIndexTemplatesRequest() and GetIndexRequest() to retrieve the version number. I keep on getting the following exception:  
`[299 Elasticsearch-6.8.7-c63e621 "[types removal] The parameter include_type_name should be explicitly specified in get template requests to prepare for 7.0. In 7.0 include_type_name will default to 'false', which means responses will omit the type name in mapping definitions."]`  
How do I set the include\_type\_name to these calls?  
Thank you for your help

---

<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: [May 14, 2020, 1:12pm UTC](https://discuss.elastic.co/t/how-to-set-include-type-name-hlclient-getindextemplatesrequest-or-getindexrequest/232498/3 "2020-05-14T13:12:50Z")

</div>

I think that you can not add `include_type_name` parameter.

Could you share more about your code and the exact version of the HLClient you are using?

---

<div class="post-metadata">

### Author: ![Cat](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@Cat](https://discuss.elastic.co/u/Cat)
#### Post date: [May 14, 2020, 3:57pm UTC](https://discuss.elastic.co/t/how-to-set-include-type-name-hlclient-getindextemplatesrequest-or-getindexrequest/232498/4 "2020-05-14T15:57:20Z")

</div>

pom.xml:

```auto
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-client</artifactId>
            <version>LATEST</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>LATEST</version>
        </dependency>

LATEST: 7.7.0
*By downgrading the version for elasticsearch.client to match the server's, it fixes the exception. However, I still don't get any response back. Not even exception*

```

very simple piece of codes....  
Didn't get any of my LOGGER statement.

```auto
        try {
            final GetIndexTemplatesRequest request = new GetIndexTemplatesRequest(
                    "my_metadata_template");
            final GetIndexTemplatesResponse response = client.indices()
                    .getIndexTemplate(request, RequestOptions.DEFAULT);
            LOGGER.debug("After GetIndexTemplatesRequest ...");
       } catch (final Exception ex) {
           LOGGER.error("Exception: " ex);
       }

```

and the results:

```auto
2020-05-14 15:52:29.585 WARN 7 --- [nio-9991-exec-6] o.e.c.RestClient : request [GET http://<myserver>/_template/documents_metadata_template?master_timeout=30s] returned 1 warnings: [299 Elasticsearch-6.8.7-c63e621 "[types removal] The parameter include_type_name should be explicitly specified in get template requests to prepare for 7.0. In 7.0 include_type_name will default to 'false', which means responses will omit the type name in mapping definitions."]

```

In Kibana, after executing

```auto
GET cat/_mapping

```

I also see this message at the very top

```auto
#! Deprecation: [types removal] The parameter include_type_name should be explicitly specified in get mapping requests to prepare for 7.0. In 7.0 include_type_name will default to 'false', which means responses will omit the type name in mapping definitions.

```

Thank you very much for your help!

---

<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: [May 14, 2020, 4:08pm UTC](https://discuss.elastic.co/t/how-to-set-include-type-name-hlclient-getindextemplatesrequest-or-getindexrequest/232498/5 "2020-05-14T16:08:58Z")

</div>

`LATEST` means that you are using a 7.7.0 client?

---

<div class="post-metadata">

### Author: ![Cat](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@Cat](https://discuss.elastic.co/u/Cat)
#### Post date: [May 14, 2020, 4:31pm UTC](https://discuss.elastic.co/t/how-to-set-include-type-name-hlclient-getindextemplatesrequest-or-getindexrequest/232498/6 "2020-05-14T16:31:18Z")

</div>

correct

---

<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: [May 14, 2020, 4:56pm UTC](https://discuss.elastic.co/t/how-to-set-include-type-name-hlclient-getindextemplatesrequest-or-getindexrequest/232498/7 "2020-05-14T16:56:12Z")

</div>

But you are using elasticsearch 6.8.7, right?

You must read this: [Compatibility | Java REST Client [7.17] | Elastic](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-compatibility.html)

> The High Level Client is guaranteed to be able to communicate with any Elasticsearch node running on **the same major version** and greater or equal minor version. It doesn’t need to be in the same minor version as the Elasticsearch nodes it communicates with, as it is forward compatible meaning that it supports communicating with later versions of Elasticsearch than the one it was developed for.

---

<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: [June 11, 2020, 6:57pm UTC](https://discuss.elastic.co/t/how-to-set-include-type-name-hlclient-getindextemplatesrequest-or-getindexrequest/232498/9 "2020-06-11T18:57:23Z")

</div>

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