Good morning, We are planning to upgrade to springboot3.0 and we are heavily using the deprecated client named HighRestLevelClient which is removed in springboot3 and replaced with the new java api client named ElasticSearchClient. however, we are runinng into some troubles because there is a big lag between the two clients. For example, our application creates indexes along with ilm policies (index lifecycle management) in this way :
private static void createIlmPolicy(RestHighLevelClient elasticClient, ElasticProperties elasticProperties) throws IOException {
if (elasticProperties.getIndexPolicies() != null) {
IndexLifecycleNamedXContentProvider indexLifecycleNamedXContentProvider = new IndexLifecycleNamedXContentProvider();
NamedXContentRegistry registry = new NamedXContentRegistry(indexLifecycleNamedXContentProvider.getNamedXContentParsers());
for (IndexPolicy p : elasticProperties.getIndexPolicies()) {
elasticClient.indexLifecycle().putLifecyclePolicy(
new PutLifecyclePolicyRequest(
LifecyclePolicy.parse(
JsonXContent.jsonXContent.createParser(registry, LoggingDeprecationHandler.INSTANCE, jsonMapper.writeValueAsString(p.getPolicy())),
p.getName()
)
),
RequestOptions.DEFAULT
);
}
}
}
How can we do this with the new java client, knowing that there is nomore indexLifecycle() ,putLifecyclePolicy() methods availble in the java api client? Thanks in advance.