use of io.searchbox.indices.settings.UpdateSettings in project graylog2-server by Graylog2.
the class IndicesAdapterES6 method setReadOnly.
@Override
public void setReadOnly(String index) {
// https://www.elastic.co/guide/en/elasticsearch/reference/6.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 UpdateSettings request = new UpdateSettings.Builder(settings).addIndex(index).build();
JestUtils.execute(jestClient, request, () -> "Couldn't set index " + index + " to read-only");
}
Aggregations