use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.RequestOptions in project graylog2-server by Graylog2.
the class ClusterAdapterES7 method clusterAllocationDiskSettings.
@Override
public ClusterAllocationDiskSettings clusterAllocationDiskSettings() {
final ClusterGetSettingsRequest request = new ClusterGetSettingsRequest();
request.includeDefaults(true);
final ClusterGetSettingsResponse response = client.execute((c, requestOptions) -> c.cluster().getSettings(request, requestOptions));
return ClusterAllocationDiskSettingsFactory.create(Boolean.parseBoolean(response.getSetting("cluster.routing.allocation.disk.threshold_enabled")), response.getSetting("cluster.routing.allocation.disk.watermark.low"), response.getSetting("cluster.routing.allocation.disk.watermark.high"), response.getSetting("cluster.routing.allocation.disk.watermark.flood_stage"));
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.RequestOptions in project graylog2-server by Graylog2.
the class IndicesAdapterES7 method updateIndexMapping.
@Override
public void updateIndexMapping(@Nonnull String indexName, @Nonnull String mappingType, @Nonnull Map<String, Object> mapping) {
final PutMappingRequest request = new PutMappingRequest(indexName).source(mapping);
client.execute((c, requestOptions) -> c.indices().putMapping(request, requestOptions), "Unable to update index mapping " + indexName);
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.RequestOptions in project graylog2-server by Graylog2.
the class IndicesAdapterES7 method removeAlias.
@Override
public void removeAlias(String index, String alias) {
final DeleteAliasRequest request = new DeleteAliasRequest(index, alias);
client.execute((c, requestOptions) -> c.indices().deleteAlias(request, requestOptions), "Unable to remove alias " + alias + ", pointing to " + index);
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.RequestOptions in project graylog2-server by Graylog2.
the class IndicesAdapterES7 method cycleAlias.
@Override
public void cycleAlias(String aliasName, String targetIndex, String oldIndex) {
final IndicesAliasesRequest.AliasActions addAlias = new IndicesAliasesRequest.AliasActions(IndicesAliasesRequest.AliasActions.Type.ADD).index(targetIndex).alias(aliasName);
final IndicesAliasesRequest.AliasActions removeAlias = new IndicesAliasesRequest.AliasActions(IndicesAliasesRequest.AliasActions.Type.REMOVE).index(oldIndex).alias(aliasName);
final IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest().addAliasAction(removeAlias).addAliasAction(addAlias);
client.execute((c, requestOptions) -> c.indices().updateAliases(indicesAliasesRequest, requestOptions), "Couldn't switch alias " + aliasName + " from index " + oldIndex + " to index " + targetIndex);
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.RequestOptions in project graylog2-server by Graylog2.
the class IndicesAdapterES7 method optimizeIndex.
@Override
public void optimizeIndex(String index, int maxNumSegments, Duration timeout) {
final ForceMergeRequest request = new ForceMergeRequest().indices(index).maxNumSegments(maxNumSegments).flush(true);
client.execute((c, requestOptions) -> c.indices().forcemerge(request, withTimeout(requestOptions, timeout)));
}
Aggregations