ALX_DM
(ALX DM)
June 28, 2022, 3:26am
1
Lets say we get the index replica count, how to do it using the new elasticsearch-java api client.
In raw form, I will just do
GET /my-index-000001/_settings
In HLRC, I do it like this
final GetSettingsRequest request = new GetSettingsRequest().indices(indexName);
final GetSettingsResponse response;
try {
response = client.indices().getSettings(request, RequestOptions.DEFAULT);
} catch (final IOException e) {
throw new UncheckedIOException(e);
}
I am at lost on how to do this in the new elasticsearch-java api client.
Any help is appreciated.
ALX_DM
(ALX DM)
June 28, 2022, 4:36am
2
was able to somehow get the idea by this
GetIndicesSettingsRequest request = GetIndicesSettingsRequest.of(b->b.index(indexName));
GetIndicesSettingsResponse response;
try {
response = client2.indices().getSettings(request);
} catch (final IOException e) {
throw new UncheckedIOException(e);
}
IndexState state = response.get("no_of_replica");
RabBit_BR
(andre.coelho)
June 28, 2022, 11:14am
3
Try this:
System.out.println(response.get("idx_name").settings().index().numberOfReplicas());
System.out.println(response.get("idx_name").settings().index().numberOfShards());
ALX_DM
(ALX DM)
June 28, 2022, 3:11pm
4
nice, thanks, this is so helpful, appreciate it very much
system
(system)
Closed
July 26, 2022, 3:12pm
5
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.