use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Request in project graylog2-server by Graylog2.
the class IndicesAdapterES7 method move.
@Override
public void move(String source, String target, Consumer<IndexMoveResult> resultCallback) {
final ReindexRequest request = new ReindexRequest();
request.setSourceIndices(source);
request.setDestIndex(target);
final BulkByScrollResponse result = client.execute((c, requestOptions) -> c.reindex(request, requestOptions));
final IndexMoveResult indexMoveResult = IndexMoveResult.create(Math.toIntExact(result.getTotal()), result.getTook().millis(), !result.getBulkFailures().isEmpty());
resultCallback.accept(indexMoveResult);
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Request in project graylog2-server by Graylog2.
the class IndicesAdapterES7 method flush.
@Override
public void flush(String index) {
final FlushRequest request = new FlushRequest(index);
client.execute((c, requestOptions) -> c.indices().flush(request, requestOptions), "Unable to flush index " + index);
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Request in project graylog2-server by Graylog2.
the class IndicesAdapterES7 method setReadOnly.
@Override
public void setReadOnly(String index) {
// https://www.elastic.co/guide/en/elasticsearch/reference/7.8/indices-update-settings.html
final Map<String, Object> settings = ImmutableMap.of("index", ImmutableMap.of("blocks", ImmutableMap.of(// Block writing.
"write", // Block writing.
true, // Allow reading.
"read", // Allow reading.
false, "metadata", // Allow getting metadata.
false)));
final UpdateSettingsRequest request = new UpdateSettingsRequest(index).settings(settings);
client.execute((c, requestOptions) -> c.indices().putSettings(request, requestOptions), "Couldn't set index " + index + " to read-only");
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Request in project graylog2-server by Graylog2.
the class CatApi method request.
private Request request(@SuppressWarnings("SameParameterValue") String method, String endpoint) {
final Request request = new Request(method, "/_cat/" + endpoint);
request.addParameter("format", "json");
return request;
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Request in project graylog2-server by Graylog2.
the class CatApi method requestIndices.
private JsonNode requestIndices(String indexName, String errorMessage) {
final Request request = request("GET", "indices/" + indexName);
request.addParameter("h", "index,status");
request.addParameter("expand_wildcards", "all");
request.addParameter("s", "index,status");
return perform(request, new TypeReference<JsonNode>() {
}, errorMessage);
}
Aggregations