use of org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest in project sonarqube by SonarSource.
the class IndexCreatorTest method isNotReadOnly.
private boolean isNotReadOnly(IndexMainType mainType) {
String indexName = mainType.getIndex().getName();
String readOnly = es.client().getSettings(new GetSettingsRequest().indices(indexName)).getSetting(indexName, "index.blocks.read_only_allow_delete");
return readOnly == null;
}
use of org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest in project openk9 by smclab.
the class ReindexDatasourceConsumer method activate.
@Activate
void activate() {
RestHighLevelClient restHighLevelClient = _restHighLevelClientProvider.get();
_disposable = _datasourceEventConsumer.datasourceUpdateEvents().flatMap(datasource -> _pluginDriverManagerClient.getPluginDriver(datasource.getDriverServiceName()).onErrorResume(throwable -> {
if (_log.isErrorEnabled()) {
_log.error(throwable.getMessage());
}
return Mono.empty();
}).map(pluginDriverDTO -> Tuples.of(datasource, datasource.getTenantId() + "-" + pluginDriverDTO.getName() + "-data"))).filterWhen(t2 -> Mono.create(sink -> restHighLevelClient.indices().existsAsync(new GetIndexRequest(t2.getT2()), RequestOptions.DEFAULT, new ReactorActionListener<>(sink)))).flatMap(t2 -> Mono.<GetSettingsResponse>create(sink -> restHighLevelClient.indices().getSettingsAsync(new GetSettingsRequest().indices(t2.getT2()).names("index.creation_date"), RequestOptions.DEFAULT, new ReactorActionListener<>(sink))).map(response -> Tuples.of(t2.getT1(), t2.getT2(), Instant.ofEpochMilli(Long.parseLong(response.getSetting(t2.getT2(), "index.creation_date")))))).log().filter(t3 -> t3.getT1().getLastIngestionDate().isBefore(t3.getT3())).flatMap(t3 -> Mono.<AcknowledgedResponse>create(sink -> restHighLevelClient.indices().deleteAsync(new DeleteIndexRequest(t3.getT2()), RequestOptions.DEFAULT, new ReactorActionListener<>(sink)))).onErrorContinue((throwable, ignore) -> {
if (_log.isErrorEnabled()) {
_log.error(throwable.getMessage());
}
}).subscribe();
}
use of org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest in project search by craftercms.
the class ElasticsearchAdminServiceImpl method doGetIndexSettings.
protected Map<String, String> doGetIndexSettings(RestHighLevelClient client, String indexName) throws IOException {
GetSettingsResponse response = client.indices().getSettings(new GetSettingsRequest().indices(indexName), RequestOptions.DEFAULT);
Map<String, String> settings = new HashMap<>(defaultSettings);
defaultSettings.keySet().forEach(key -> {
String value = response.getSetting(indexName, key);
if (isNotEmpty(value)) {
logger.debug("Using existing setting {}={} from index {}", key, value, indexName);
settings.put(key, value);
}
});
return settings;
}
use of org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest in project spring-data-elasticsearch by spring-projects.
the class RequestConverters method getSettings.
public static Request getSettings(GetSettingsRequest getSettingsRequest) {
String[] indices = getSettingsRequest.indices() == null ? Strings.EMPTY_ARRAY : getSettingsRequest.indices();
String[] names = getSettingsRequest.names() == null ? Strings.EMPTY_ARRAY : getSettingsRequest.names();
Request request = new Request(HttpMethod.GET.name(), RequestConverters.endpoint(indices, "_settings", names));
RequestConverters.Params parameters = new RequestConverters.Params(request);
parameters.withIndicesOptions(getSettingsRequest.indicesOptions());
parameters.withLocal(getSettingsRequest.local());
parameters.withIncludeDefaults(getSettingsRequest.includeDefaults());
parameters.withMasterTimeout(getSettingsRequest.masterNodeTimeout());
return request;
}
use of org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest in project spring-data-elasticsearch by spring-projects.
the class ReactiveIndexTemplate method getSettings.
@Override
public Mono<Settings> getSettings(boolean includeDefaults) {
String indexName = getIndexCoordinates().getIndexName();
GetSettingsRequest request = requestFactory.getSettingsRequest(indexName, includeDefaults);
return Mono.from(operations.executeWithIndicesClient(client -> client.getSettings(request))).map(getSettingsResponse -> ResponseConverter.fromSettingsResponse(getSettingsResponse, indexName));
}
Aggregations