Search in sources :

Example 1 with UpdateSettings

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");
}
Also used : FieldSortBuilder(org.graylog.shaded.elasticsearch6.org.elasticsearch.search.sort.FieldSortBuilder) SearchSourceBuilder(org.graylog.shaded.elasticsearch6.org.elasticsearch.search.builder.SearchSourceBuilder) FilterAggregationBuilder(org.graylog.shaded.elasticsearch6.org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder) UpdateSettings(io.searchbox.indices.settings.UpdateSettings)

Aggregations

UpdateSettings (io.searchbox.indices.settings.UpdateSettings)1 FilterAggregationBuilder (org.graylog.shaded.elasticsearch6.org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder)1 SearchSourceBuilder (org.graylog.shaded.elasticsearch6.org.elasticsearch.search.builder.SearchSourceBuilder)1 FieldSortBuilder (org.graylog.shaded.elasticsearch6.org.elasticsearch.search.sort.FieldSortBuilder)1