# Elastic Search 8.3 integration Issue with Rest High Client 7.17.6

**URL:** <https://discuss.elastic.co/t/elastic-search-8-3-integration-issue-with-rest-high-client-7-17-6/323035>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [January 12, 2023, 3:05pm UTC](https://discuss.elastic.co/t/elastic-search-8-3-integration-issue-with-rest-high-client-7-17-6/323035 "2023-01-12T15:05:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sidchaug](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@sidchaug](https://discuss.elastic.co/u/sidchaug)\
**Post date:** [January 12, 2023, 3:05pm UTC](https://discuss.elastic.co/t/elastic-search-8-3-integration-issue-with-rest-high-client-7-17-6/323035/1 "2023-01-12T15:05:33Z")

</div>

Hi Team,

We are currently working on 6.3 Version of ES and 6.4v of RestHighLevelClient we are upgrading to ES 8.3v so the code written in earlier version of ES with RestHigh client we are facing challenges to upgrade.

Current ES 8.3 and RestHighClient 7.17.6 we are trying to createIndex with below snippet

_private boolean createIndex() throws Exception {_  
_CreateIndexRequest createIndexRequest = new CreateIndexRequest("giftcard\_1");_  
_createIndexRequest.settings(PARTIAL\_MATCH\_INDEX\_SETTING, XContentType.JSON);_  
_createIndexRequest.mapping(type, GIFT\_CARD\_MAPPING, XContentType.JSON);_  
_CreateIndexResponse createIndexResponse = client.indices().create(createIndexRequest, RequestOptions.DEFAULT);_  
_return createIndexResponse.isAcknowledged();_

Where the Constants used in Code are  
static final String PARTIAL\_MATCH\_INDEX\_SETTING = "{\r\n" +  
" "analysis": {\r\n" +  
" "analyzer": {\r\n" +  
" "partial\_search\_analyzer": {\r\n" +  
" "tokenizer": "partial\_tokenizer",\r\n" +  
" "filter": [\r\n" +  
" "lowercase"\r\n" +  
" ]\r\n" +  
" }\r\n" +  
" },\r\n" +  
" "tokenizer": {\r\n" +  
" "partial\_tokenizer": {\r\n" +  
" "type": "edge\_ngram",\r\n" +  
" "min\_gram": 3,\r\n" +  
" "max\_gram": 3,\r\n" +  
" "token\_chars": [\r\n" +  
" "letter",\r\n" +  
" "digit",\r\n" +  
" "symbol",\r\n" +  
" "punctuation",\r\n" +  
" "whitespace"\r\n" +  
" ]\n" +  
" }\n" +  
" }\n" +  
" }\n" +  
"}";

static final String GIFT\_CARD\_MAPPING = "{\r\n" +  
" "properties": {\r\n" +  
" "bhn": {\r\n" +  
" "properties": {\r\n" +  
" "brandDescription": {\r\n" +  
" "properties": {\r\n" +  
" "eng": {\r\n" +  
" "type": "text",\r\n" +  
" "fields": {\r\n" +  
" "keyword": {\r\n" +  
" "type": "keyword",\r\n" +  
" "ignore\_above": 256\r\n" +  
" }\r\n" +  
" },\r\n" +  
" "analyzer": "partial\_search\_analyzer"\r\n" +  
" },\r\n" +  
" "spa": {\r\n" +  
" "type": "text",\r\n" +  
" "fields": {\r\n" +  
" "keyword": {\r\n" +  
" "type": "keyword",\r\n" +  
" "ignore\_above": 256\r\n" +  
" }\r\n" +  
" },\r\n" +  
" "analyzer": "partial\_search\_analyzer"\r\n" +  
" }\r\n" +  
" }\r\n" +  
" },\r\n" +  
" "brandName": {\r\n" +  
" "properties": {\r\n" +  
" "eng": {\r\n" +  
" "type": "text",\r\n" +  
" "fields": {\r\n" +  
" "keyword": {\r\n" +  
" "type": "keyword",\r\n" +  
" "ignore\_above": 256\r\n" +  
" }\r\n" +  
" },\r\n" +  
" "analyzer": "partial\_search\_analyzer"\r\n" +  
" },\r\n" +  
" "spa": {\r\n" +  
" "type": "text",\r\n" +  
" "fields": {\r\n" +  
" "keyword": {\r\n" +  
" "type": "keyword",\r\n" +  
" "ignore\_above": 256\r\n" +  
" }\r\n" +  
" },\r\n" +  
" "analyzer": "partial\_search\_analyzer"\r\n" +  
" }\r\n" +  
" }\r\n" +  
" }\r\n" +  
" }\r\n" +  
" }\r\n" +  
" }\r\n" +  
"}";

But when we are trying to execute this piece of code snipped we get the below Exception

**[\_\_\_\_\_\_\_\_,[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)']:E: 12 08:42:34.032: GCCatalogSchedulerJob.performScheduledJob: Fatal Exception occurred in GCCatalog Scheduler Job : _java.lang.Exception: ElasticsearchStatusException[Elasticsearch exception [type=illegal\_argument\_exception, reason=request [/giftcards\_1] contains unrecognized parameter: [include\_type\_name]]]_**  
**[\_\_\_\_\_\_\_\_,[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)']:I: 12 08:42:34.033: GCCatalogSchedulerJob.performScheduledJob: GiftCard get Catalog : Total Time taken to update catalog: 4280**  
**[\_\_\_\_\_\_\_\_,[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)']:I: 12 08:42:34.033: GCCatalogSchedulerJob.performScheduledJob: Giftcard Catalog Scheduler End Date & Time : 01/12/2023 08:42:34**

Note the code fails when working with ES 8.3 with RestHighClient 7.17.6 intergration, when i run the above Mappings & Setting defined in constants directly on ES devtools they work FINE(with No ERROR)

Please Assist any help would be Appreciated!!!

---

<div class="post-metadata">

**Author:** ![swallez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swallez/32/11972_2.png) [@swallez](https://discuss.elastic.co/u/swallez)\
**Post date:** [January 12, 2023, 5:32pm UTC](https://discuss.elastic.co/t/elastic-search-8-3-integration-issue-with-rest-high-client-7-17-6/323035/2 "2023-01-12T17:32:21Z")

</div>

Have you [enabled compatibility mode](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-compatibility.html) in your Rest High Level Client? This allows Elasticsearch 8 to know that it's called by a client for version 7.x and use a compatible API.

---

<div class="post-metadata">

**Author:** ![sidchaug](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@sidchaug](https://discuss.elastic.co/u/sidchaug)\
**Post date:** [January 12, 2023, 5:49pm UTC](https://discuss.elastic.co/t/elastic-search-8-3-integration-issue-with-rest-high-client-7-17-6/323035/3 "2023-01-12T17:49:15Z")

</div>

Thanks Sylvain Sir,

Here is our code for connecting, can you suggest where we can integrate the set compatibility part??

Code Snippet  
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();  
credentialsProvider.setCredentials(AuthScope.ANY,new UsernamePasswordCredentials(propertyConfig.getUserName(), propertyConfig.getPassword()));  
RestClientBuilder builder = RestClient.builder(new HttpHost(propertyConfig.getEsHost(),  
Integer.parseInt(propertyConfig.getEsPort()), propertyConfig.getEsSchema())).setHttpClientConfigCallback(httpClientBuilder -\>  
httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider));  
RestHighLevelClient client = new RestHighLevelClient(builder);

```
        return client; 

```

Thanks  
Siddharth

---

<div class="post-metadata">

**Author:** ![swallez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swallez/32/11972_2.png) [@swallez](https://discuss.elastic.co/u/swallez)\
**Post date:** [January 12, 2023, 7:17pm UTC](https://discuss.elastic.co/t/elastic-search-8-3-integration-issue-with-rest-high-client-7-17-6/323035/4 "2023-01-12T19:17:48Z")

</div>

Please see the example in the documentation, it's pretty straightforward.

Also, it would be nice if you could format the code snippets correctly in your posts. As it is, they are quite hard to read. Thanks!

---

<div class="post-metadata">

**Author:** ![sidchaug](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@sidchaug](https://discuss.elastic.co/u/sidchaug)\
**Post date:** [January 13, 2023, 1:32pm UTC](https://discuss.elastic.co/t/elastic-search-8-3-integration-issue-with-rest-high-client-7-17-6/323035/5 "2023-01-13T13:32:21Z")

</div>

Thanks Sylvain , we tried but faced issue

I am resending the code

Code Snippet

```auto

final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();

credentialsProvider.setCredentials(AuthScope.ANY,new UsernamePasswordCredentials(propertyConfig.getUserName(), propertyConfig.getPassword()));

RestClientBuilder builder = RestClient.builder(new HttpHost(propertyConfig.getEsHost(),
Integer.parseInt(propertyConfig.getEsPort()), propertyConfig.getEsSchema())).setHttpClientConfigCallback(httpClientBuilder ->
httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider));

RestHighLevelClient client = new RestHighLevelClient(builder);

return client;

```

Thanks  
Siddharth

---

<div class="post-metadata">

**Author:** ![sidchaug](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@sidchaug](https://discuss.elastic.co/u/sidchaug)\
**Post date:** [January 18, 2023, 2:45pm UTC](https://discuss.elastic.co/t/elastic-search-8-3-integration-issue-with-rest-high-client-7-17-6/323035/6 "2023-01-18T14:45:25Z")

</div>

Hi Sylvain

What object is restClient in the below code

```auto
RestHighLevelClient esClient = new RestHighLevelClientBuilder(restClient)
    .setApiCompatibilityMode(true)
    .build()

```

Thanks  
Siddharth

---

<div class="post-metadata">

**Author:** ![sidchaug](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@sidchaug](https://discuss.elastic.co/u/sidchaug)\
**Post date:** [January 31, 2023, 9:34am UTC](https://discuss.elastic.co/t/elastic-search-8-3-integration-issue-with-rest-high-client-7-17-6/323035/7 "2023-01-31T09:34:08Z")

</div>

Thanks Sylvain , for you assistance we figured out and fixed the issue

---

<div class="post-metadata">

**Author:** ![swallez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swallez/32/11972_2.png) [@swallez](https://discuss.elastic.co/u/swallez)\
**Post date:** [February 14, 2023, 12:52pm UTC](https://discuss.elastic.co/t/elastic-search-8-3-integration-issue-with-rest-high-client-7-17-6/323035/8 "2023-02-14T12:52:14Z")

</div>


