use of io.searchbox.indices.settings.GetSettings in project graylog2-server by Graylog2.
the class IndicesAdapterES6 method indexCreationDate.
@Override
public Optional<DateTime> indexCreationDate(String index) {
final GetSettings request = new GetSettings.Builder().addIndex(index).ignoreUnavailable(true).build();
final JestResult jestResult = JestUtils.execute(jestClient, request, () -> "Couldn't read settings of index " + index);
return Optional.of(jestResult.getJsonObject().path(index).path("settings").path("index").path("creation_date")).filter(JsonNode::isValueNode).map(JsonNode::asLong).map(creationDate -> new DateTime(creationDate, DateTimeZone.UTC));
}
use of io.searchbox.indices.settings.GetSettings in project herd by FINRAOS.
the class IndexFunctionsDaoImpl method getIndexSettings.
@Override
public Settings getIndexSettings(String indexName) {
GetSettings getSettings = new GetSettings.Builder().addIndex(indexName).build();
JestResult result = jestClientHelper.executeAction(getSettings);
Assert.isTrue(result.isSucceeded(), result.getErrorMessage());
JsonObject json = result.getJsonObject().getAsJsonObject(indexName).getAsJsonObject("settings");
return Settings.builder().loadFromSource(json.toString()).build();
}
Aggregations