HLRC Issue Porting from 2.6 to 2.9

Versions (porting from HLRC 2.6 to 2.9):

Describe the issue:
Porting from OpenSearch 2.6 to 2.9

The High Level Rest Client (HLRC) for version 2.6 utilizes the following import statement import org.opensearch.common.xcontent.XContentBuilder;

In the 2.9 release this was changed to import org.opensearch.core.xcontent.XContentBuilder;

The sample code for HLRC fails when performing a createindex mapping request

CreateIndexRequest createIndexRequest = new CreateIndexRequest(“test-me”); createIndexRequest.settings(Settings.builder() .put(“index.number_of_shards”, 1) .put(“index.number_of_replicas”, 0) );

try { HashMap<String, String> typeMapping = new HashMap<String, String>(); typeMapping.put(“type”, “integer”); HashMap<String, Object> ageMapping = new HashMap<String, Object>(); ageMapping.put(“age”, typeMapping); HashMap<String, Object> mapping = new HashMap<String, Object>(); mapping.put(“properties”, ageMapping);


CreateIndexResponse createIndexResponse = restClient.indices().create(createIndexRequest, RequestOptions.DEFAULT);

The 2.6 HLRC works otherwise on the 2.9 release.


Relevant Logs or Screenshots:

Hey @docme, the XContentBuilder has been moved under different package in 2.9 indeed

Yes, when I switched all code to reference core vs common, I get the error.

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