How to set include_type_name HLClient GetIndexTemplatesRequest() or GetIndexRequest()

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

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?

pom.xml:

        <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.

        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:

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

GET cat/_mapping

I also see this message at the very top

#! 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!

LATEST means that you are using a 7.7.0 client?

correct

But you are using elasticsearch 6.8.7, right?

You must read this: Compatibility | Java REST Client [7.17] | Elastic

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.

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