Search in sources :

Example 41 with AcknowledgedResponse

use of org.elasticsearch.action.support.master.AcknowledgedResponse in project graylog2-server by Graylog2.

the class V20200730000000_AddGl2MessageIdFieldAliasForEventsES7IT method createIndicesWithIdMapping.

private void createIndicesWithIdMapping(String... indices) {
    for (String index : indices) {
        client().createIndex(index);
    }
    final PutMappingRequest putMappingRequest = new PutMappingRequest(indices).source(idMapping());
    final AcknowledgedResponse acknowledgedResponse = elasticsearch.elasticsearchClient().execute((c, opt) -> c.indices().putMapping(putMappingRequest, opt));
    if (!acknowledgedResponse.isAcknowledged()) {
        throw new RuntimeException("Failed to add 'id' mapping for indices " + Arrays.toString(indices));
    }
}
Also used : PutMappingRequest(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.indices.PutMappingRequest) AcknowledgedResponse(org.graylog.shaded.elasticsearch7.org.elasticsearch.action.support.master.AcknowledgedResponse)

Aggregations

AcknowledgedResponse (org.elasticsearch.action.support.master.AcknowledgedResponse)37 IOException (java.io.IOException)11 FutureActionListener (io.crate.action.FutureActionListener)9 ClusterState (org.elasticsearch.cluster.ClusterState)7 Row1 (io.crate.data.Row1)6 Map (java.util.Map)6 DeleteIndexRequest (org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest)6 ClusterBlockException (org.elasticsearch.cluster.block.ClusterBlockException)6 Metadata (org.elasticsearch.cluster.metadata.Metadata)6 Row (io.crate.data.Row)5 RelationName (io.crate.metadata.RelationName)5 Arrays (java.util.Arrays)5 HashMap (java.util.HashMap)5 List (java.util.List)5 Reference (io.crate.metadata.Reference)4 DataType (io.crate.types.DataType)4 ArrayList (java.util.ArrayList)4 CompletableFuture (java.util.concurrent.CompletableFuture)4 StreamSupport (java.util.stream.StreamSupport)4 ClusterService (org.elasticsearch.cluster.service.ClusterService)4