Search in sources :

Example 1 with DeleteIndexTemplateRequest

use of org.opensearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest in project OpenSearch by opensearch-project.

the class IndicesRequestConverters method deleteIndexTemplate.

static Request deleteIndexTemplate(DeleteComposableIndexTemplateRequest deleteIndexTemplateRequest) {
    String name = deleteIndexTemplateRequest.getName();
    String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_index_template").addPathPart(name).build();
    Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
    RequestConverters.Params params = new RequestConverters.Params();
    params.withMasterTimeout(deleteIndexTemplateRequest.masterNodeTimeout());
    request.addParameters(params.asMap());
    return request;
}
Also used : UpdateSettingsRequest(org.opensearch.action.admin.indices.settings.put.UpdateSettingsRequest) CreateIndexRequest(org.opensearch.client.indices.CreateIndexRequest) SimulateIndexTemplateRequest(org.opensearch.client.indices.SimulateIndexTemplateRequest) FlushRequest(org.opensearch.action.admin.indices.flush.FlushRequest) RefreshRequest(org.opensearch.action.admin.indices.refresh.RefreshRequest) GetIndexRequest(org.opensearch.client.indices.GetIndexRequest) DeleteAliasRequest(org.opensearch.client.indices.DeleteAliasRequest) OpenIndexRequest(org.opensearch.action.admin.indices.open.OpenIndexRequest) GetFieldMappingsRequest(org.opensearch.client.indices.GetFieldMappingsRequest) ForceMergeRequest(org.opensearch.action.admin.indices.forcemerge.ForceMergeRequest) GetSettingsRequest(org.opensearch.action.admin.indices.settings.get.GetSettingsRequest) GetDataStreamRequest(org.opensearch.client.indices.GetDataStreamRequest) DeleteIndexRequest(org.opensearch.action.admin.indices.delete.DeleteIndexRequest) ComposableIndexTemplateExistRequest(org.opensearch.client.indices.ComposableIndexTemplateExistRequest) AnalyzeRequest(org.opensearch.client.indices.AnalyzeRequest) ResizeRequest(org.opensearch.client.indices.ResizeRequest) GetComposableIndexTemplateRequest(org.opensearch.client.indices.GetComposableIndexTemplateRequest) DataStreamsStatsRequest(org.opensearch.client.indices.DataStreamsStatsRequest) DeleteIndexTemplateRequest(org.opensearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest) CloseIndexRequest(org.opensearch.client.indices.CloseIndexRequest) GetIndexTemplatesRequest(org.opensearch.client.indices.GetIndexTemplatesRequest) GetMappingsRequest(org.opensearch.client.indices.GetMappingsRequest) GetAliasesRequest(org.opensearch.action.admin.indices.alias.get.GetAliasesRequest) PutComposableIndexTemplateRequest(org.opensearch.client.indices.PutComposableIndexTemplateRequest) CreateDataStreamRequest(org.opensearch.client.indices.CreateDataStreamRequest) IndicesAliasesRequest(org.opensearch.action.admin.indices.alias.IndicesAliasesRequest) PutMappingRequest(org.opensearch.client.indices.PutMappingRequest) DeleteComposableIndexTemplateRequest(org.opensearch.client.indices.DeleteComposableIndexTemplateRequest) PutIndexTemplateRequest(org.opensearch.client.indices.PutIndexTemplateRequest) ValidateQueryRequest(org.opensearch.action.admin.indices.validate.query.ValidateQueryRequest) DeleteDataStreamRequest(org.opensearch.client.indices.DeleteDataStreamRequest) ClearIndicesCacheRequest(org.opensearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest) IndexTemplatesExistRequest(org.opensearch.client.indices.IndexTemplatesExistRequest) RolloverRequest(org.opensearch.client.indices.rollover.RolloverRequest)

Example 2 with DeleteIndexTemplateRequest

use of org.opensearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest in project OpenSearch by opensearch-project.

the class IndicesRequestConverters method deleteTemplate.

static Request deleteTemplate(DeleteIndexTemplateRequest deleteIndexTemplateRequest) {
    String name = deleteIndexTemplateRequest.name();
    String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_template").addPathPart(name).build();
    Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
    RequestConverters.Params params = new RequestConverters.Params();
    params.withMasterTimeout(deleteIndexTemplateRequest.masterNodeTimeout());
    request.addParameters(params.asMap());
    return request;
}
Also used : UpdateSettingsRequest(org.opensearch.action.admin.indices.settings.put.UpdateSettingsRequest) CreateIndexRequest(org.opensearch.client.indices.CreateIndexRequest) SimulateIndexTemplateRequest(org.opensearch.client.indices.SimulateIndexTemplateRequest) FlushRequest(org.opensearch.action.admin.indices.flush.FlushRequest) RefreshRequest(org.opensearch.action.admin.indices.refresh.RefreshRequest) GetIndexRequest(org.opensearch.client.indices.GetIndexRequest) DeleteAliasRequest(org.opensearch.client.indices.DeleteAliasRequest) OpenIndexRequest(org.opensearch.action.admin.indices.open.OpenIndexRequest) GetFieldMappingsRequest(org.opensearch.client.indices.GetFieldMappingsRequest) ForceMergeRequest(org.opensearch.action.admin.indices.forcemerge.ForceMergeRequest) GetSettingsRequest(org.opensearch.action.admin.indices.settings.get.GetSettingsRequest) GetDataStreamRequest(org.opensearch.client.indices.GetDataStreamRequest) DeleteIndexRequest(org.opensearch.action.admin.indices.delete.DeleteIndexRequest) ComposableIndexTemplateExistRequest(org.opensearch.client.indices.ComposableIndexTemplateExistRequest) AnalyzeRequest(org.opensearch.client.indices.AnalyzeRequest) ResizeRequest(org.opensearch.client.indices.ResizeRequest) GetComposableIndexTemplateRequest(org.opensearch.client.indices.GetComposableIndexTemplateRequest) DataStreamsStatsRequest(org.opensearch.client.indices.DataStreamsStatsRequest) DeleteIndexTemplateRequest(org.opensearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest) CloseIndexRequest(org.opensearch.client.indices.CloseIndexRequest) GetIndexTemplatesRequest(org.opensearch.client.indices.GetIndexTemplatesRequest) GetMappingsRequest(org.opensearch.client.indices.GetMappingsRequest) GetAliasesRequest(org.opensearch.action.admin.indices.alias.get.GetAliasesRequest) PutComposableIndexTemplateRequest(org.opensearch.client.indices.PutComposableIndexTemplateRequest) CreateDataStreamRequest(org.opensearch.client.indices.CreateDataStreamRequest) IndicesAliasesRequest(org.opensearch.action.admin.indices.alias.IndicesAliasesRequest) PutMappingRequest(org.opensearch.client.indices.PutMappingRequest) DeleteComposableIndexTemplateRequest(org.opensearch.client.indices.DeleteComposableIndexTemplateRequest) PutIndexTemplateRequest(org.opensearch.client.indices.PutIndexTemplateRequest) ValidateQueryRequest(org.opensearch.action.admin.indices.validate.query.ValidateQueryRequest) DeleteDataStreamRequest(org.opensearch.client.indices.DeleteDataStreamRequest) ClearIndicesCacheRequest(org.opensearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest) IndexTemplatesExistRequest(org.opensearch.client.indices.IndexTemplatesExistRequest) RolloverRequest(org.opensearch.client.indices.rollover.RolloverRequest)

Example 3 with DeleteIndexTemplateRequest

use of org.opensearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest in project OpenSearch by opensearch-project.

the class IndicesClientDocumentationIT method testDeleteTemplate.

public void testDeleteTemplate() throws Exception {
    RestHighLevelClient client = highLevelClient();
    {
        PutIndexTemplateRequest putRequest = new PutIndexTemplateRequest("my-template");
        putRequest.patterns(Arrays.asList("pattern-1", "log-*"));
        putRequest.settings(Settings.builder().put("index.number_of_shards", 3));
        assertTrue(client.indices().putTemplate(putRequest, RequestOptions.DEFAULT).isAcknowledged());
    }
    // tag::delete-template-request
    DeleteIndexTemplateRequest request = new DeleteIndexTemplateRequest();
    // <1>
    request.name("my-template");
    // end::delete-template-request
    // tag::delete-template-request-masterTimeout
    // <1>
    request.masterNodeTimeout(TimeValue.timeValueMinutes(1));
    // <2>
    request.masterNodeTimeout("1m");
    // end::delete-template-request-masterTimeout
    // tag::delete-template-execute
    AcknowledgedResponse deleteTemplateAcknowledge = client.indices().deleteTemplate(request, RequestOptions.DEFAULT);
    // end::delete-template-execute
    // tag::delete-template-response
    // <1>
    boolean acknowledged = deleteTemplateAcknowledge.isAcknowledged();
    // end::delete-template-response
    assertThat(acknowledged, equalTo(true));
    {
        PutIndexTemplateRequest putRequest = new PutIndexTemplateRequest("my-template");
        putRequest.patterns(Arrays.asList("pattern-1", "log-*"));
        putRequest.settings(Settings.builder().put("index.number_of_shards", 3));
        assertTrue(client.indices().putTemplate(putRequest, RequestOptions.DEFAULT).isAcknowledged());
    }
    // tag::delete-template-execute-listener
    ActionListener<AcknowledgedResponse> listener = new ActionListener<AcknowledgedResponse>() {

        @Override
        public void onResponse(AcknowledgedResponse response) {
        // <1>
        }

        @Override
        public void onFailure(Exception e) {
        // <2>
        }
    };
    // end::delete-template-execute-listener
    // Replace the empty listener by a blocking listener in test
    final CountDownLatch latch = new CountDownLatch(1);
    listener = new LatchedActionListener<>(listener, latch);
    // tag::delete-template-execute-async
    // <1>
    client.indices().deleteTemplateAsync(request, RequestOptions.DEFAULT, listener);
    // end::delete-template-execute-async
    assertTrue(latch.await(30L, TimeUnit.SECONDS));
}
Also used : LatchedActionListener(org.opensearch.action.LatchedActionListener) ActionListener(org.opensearch.action.ActionListener) AcknowledgedResponse(org.opensearch.action.support.master.AcknowledgedResponse) PutIndexTemplateRequest(org.opensearch.client.indices.PutIndexTemplateRequest) RestHighLevelClient(org.opensearch.client.RestHighLevelClient) DeleteIndexTemplateRequest(org.opensearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest) CountDownLatch(java.util.concurrent.CountDownLatch) IOException(java.io.IOException) DefaultShardOperationFailedException(org.opensearch.action.support.DefaultShardOperationFailedException) OpenSearchException(org.opensearch.OpenSearchException)

Example 4 with DeleteIndexTemplateRequest

use of org.opensearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest in project OpenSearch by opensearch-project.

the class TemplateUpgradeServiceTests method testUpdateTemplates.

@SuppressWarnings("unchecked")
public void testUpdateTemplates() {
    int additionsCount = randomIntBetween(0, 5);
    int deletionsCount = randomIntBetween(0, 3);
    List<ActionListener<AcknowledgedResponse>> putTemplateListeners = new ArrayList<>();
    List<ActionListener<AcknowledgedResponse>> deleteTemplateListeners = new ArrayList<>();
    Client mockClient = mock(Client.class);
    AdminClient mockAdminClient = mock(AdminClient.class);
    IndicesAdminClient mockIndicesAdminClient = mock(IndicesAdminClient.class);
    when(mockClient.admin()).thenReturn(mockAdminClient);
    when(mockAdminClient.indices()).thenReturn(mockIndicesAdminClient);
    doAnswer(invocation -> {
        Object[] args = invocation.getArguments();
        assert args.length == 2;
        PutIndexTemplateRequest request = (PutIndexTemplateRequest) args[0];
        assertThat(request.name(), equalTo("add_template_" + request.order()));
        putTemplateListeners.add((ActionListener) args[1]);
        return null;
    }).when(mockIndicesAdminClient).putTemplate(any(PutIndexTemplateRequest.class), any(ActionListener.class));
    doAnswer(invocation -> {
        Object[] args = invocation.getArguments();
        assert args.length == 2;
        DeleteIndexTemplateRequest request = (DeleteIndexTemplateRequest) args[0];
        assertThat(request.name(), startsWith("remove_template_"));
        deleteTemplateListeners.add((ActionListener) args[1]);
        return null;
    }).when(mockIndicesAdminClient).deleteTemplate(any(DeleteIndexTemplateRequest.class), any(ActionListener.class));
    Set<String> deletions = new HashSet<>(deletionsCount);
    for (int i = 0; i < deletionsCount; i++) {
        deletions.add("remove_template_" + i);
    }
    Map<String, BytesReference> additions = new HashMap<>(additionsCount);
    for (int i = 0; i < additionsCount; i++) {
        additions.put("add_template_" + i, new BytesArray("{\"index_patterns\" : \"*\", \"order\" : " + i + "}"));
    }
    final TemplateUpgradeService service = new TemplateUpgradeService(mockClient, clusterService, threadPool, Collections.emptyList());
    IllegalStateException ise = expectThrows(IllegalStateException.class, () -> service.upgradeTemplates(additions, deletions));
    assertThat(ise.getMessage(), containsString("template upgrade service should always happen in a system context"));
    // +2 to skip tryFinishUpgrade
    service.upgradesInProgress.set(additionsCount + deletionsCount + 2);
    final ThreadContext threadContext = threadPool.getThreadContext();
    try (ThreadContext.StoredContext ignore = threadContext.stashContext()) {
        threadContext.markAsSystemContext();
        service.upgradeTemplates(additions, deletions);
    }
    assertThat(putTemplateListeners, hasSize(additionsCount));
    assertThat(deleteTemplateListeners, hasSize(deletionsCount));
    for (int i = 0; i < additionsCount; i++) {
        if (randomBoolean()) {
            putTemplateListeners.get(i).onFailure(new RuntimeException("test - ignore"));
        } else {
            putTemplateListeners.get(i).onResponse(new AcknowledgedResponse(randomBoolean()) {
            });
        }
    }
    for (int i = 0; i < deletionsCount; i++) {
        if (randomBoolean()) {
            int prevUpdatesInProgress = service.upgradesInProgress.get();
            deleteTemplateListeners.get(i).onFailure(new RuntimeException("test - ignore"));
            assertThat(prevUpdatesInProgress - service.upgradesInProgress.get(), equalTo(1));
        } else {
            int prevUpdatesInProgress = service.upgradesInProgress.get();
            deleteTemplateListeners.get(i).onResponse(new AcknowledgedResponse(randomBoolean()) {
            });
            assertThat(prevUpdatesInProgress - service.upgradesInProgress.get(), equalTo(1));
        }
    }
    // tryFinishUpgrade was skipped
    assertThat(service.upgradesInProgress.get(), equalTo(2));
}
Also used : BytesReference(org.opensearch.common.bytes.BytesReference) BytesArray(org.opensearch.common.bytes.BytesArray) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ThreadContext(org.opensearch.common.util.concurrent.ThreadContext) AcknowledgedResponse(org.opensearch.action.support.master.AcknowledgedResponse) PutIndexTemplateRequest(org.opensearch.action.admin.indices.template.put.PutIndexTemplateRequest) IndicesAdminClient(org.opensearch.client.IndicesAdminClient) Matchers.containsString(org.hamcrest.Matchers.containsString) DeleteIndexTemplateRequest(org.opensearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest) ActionListener(org.opensearch.action.ActionListener) Client(org.opensearch.client.Client) AdminClient(org.opensearch.client.AdminClient) IndicesAdminClient(org.opensearch.client.IndicesAdminClient) AdminClient(org.opensearch.client.AdminClient) IndicesAdminClient(org.opensearch.client.IndicesAdminClient) HashSet(java.util.HashSet)

Example 5 with DeleteIndexTemplateRequest

use of org.opensearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest in project OpenSearch by opensearch-project.

the class TemplateUpgradeServiceTests method testClusterStateUpdate.

@SuppressWarnings("unchecked")
public void testClusterStateUpdate() throws InterruptedException {
    final AtomicReference<ActionListener<AcknowledgedResponse>> addedListener = new AtomicReference<>();
    final AtomicReference<ActionListener<AcknowledgedResponse>> changedListener = new AtomicReference<>();
    final AtomicReference<ActionListener<AcknowledgedResponse>> removedListener = new AtomicReference<>();
    final Semaphore updateInvocation = new Semaphore(0);
    final Semaphore calculateInvocation = new Semaphore(0);
    final Semaphore changedInvocation = new Semaphore(0);
    final Semaphore finishInvocation = new Semaphore(0);
    Metadata metadata = randomMetadata(IndexTemplateMetadata.builder("user_template").patterns(randomIndexPatterns()).build(), IndexTemplateMetadata.builder("removed_test_template").patterns(randomIndexPatterns()).build(), IndexTemplateMetadata.builder("changed_test_template").patterns(randomIndexPatterns()).build());
    Client mockClient = mock(Client.class);
    AdminClient mockAdminClient = mock(AdminClient.class);
    IndicesAdminClient mockIndicesAdminClient = mock(IndicesAdminClient.class);
    when(mockClient.admin()).thenReturn(mockAdminClient);
    when(mockAdminClient.indices()).thenReturn(mockIndicesAdminClient);
    doAnswer(invocation -> {
        Object[] args = invocation.getArguments();
        assert args.length == 2;
        PutIndexTemplateRequest request = (PutIndexTemplateRequest) args[0];
        if (request.name().equals("added_test_template")) {
            assertThat(addedListener.getAndSet((ActionListener) args[1]), nullValue());
        } else if (request.name().equals("changed_test_template")) {
            assertThat(changedListener.getAndSet((ActionListener) args[1]), nullValue());
        } else {
            fail("unexpected put template call for " + request.name());
        }
        return null;
    }).when(mockIndicesAdminClient).putTemplate(any(PutIndexTemplateRequest.class), any(ActionListener.class));
    doAnswer(invocation -> {
        Object[] args = invocation.getArguments();
        assert args.length == 2;
        DeleteIndexTemplateRequest request = (DeleteIndexTemplateRequest) args[0];
        assertThat(request.name(), startsWith("removed_test_template"));
        assertThat(removedListener.getAndSet((ActionListener) args[1]), nullValue());
        return null;
    }).when(mockIndicesAdminClient).deleteTemplate(any(DeleteIndexTemplateRequest.class), any(ActionListener.class));
    new TemplateUpgradeService(mockClient, clusterService, threadPool, Arrays.asList(templates -> {
        assertNull(templates.put("added_test_template", IndexTemplateMetadata.builder("added_test_template").patterns(Collections.singletonList("*")).build()));
        return templates;
    }, templates -> {
        assertNotNull(templates.remove("removed_test_template"));
        return templates;
    }, templates -> {
        assertNotNull(templates.put("changed_test_template", IndexTemplateMetadata.builder("changed_test_template").patterns(Collections.singletonList("*")).order(10).build()));
        return templates;
    })) {

        @Override
        void tryFinishUpgrade(AtomicBoolean anyUpgradeFailed) {
            super.tryFinishUpgrade(anyUpgradeFailed);
            finishInvocation.release();
        }

        @Override
        void upgradeTemplates(Map<String, BytesReference> changes, Set<String> deletions) {
            super.upgradeTemplates(changes, deletions);
            updateInvocation.release();
        }

        @Override
        Optional<Tuple<Map<String, BytesReference>, Set<String>>> calculateTemplateChanges(ImmutableOpenMap<String, IndexTemplateMetadata> templates) {
            final Optional<Tuple<Map<String, BytesReference>, Set<String>>> ans = super.calculateTemplateChanges(templates);
            calculateInvocation.release();
            return ans;
        }

        @Override
        public void clusterChanged(ClusterChangedEvent event) {
            super.clusterChanged(event);
            changedInvocation.release();
        }
    };
    ClusterState prevState = ClusterState.EMPTY_STATE;
    ClusterState state = ClusterState.builder(prevState).nodes(DiscoveryNodes.builder().add(new DiscoveryNode("node1", "node1", buildNewFakeTransportAddress(), emptyMap(), MASTER_DATA_ROLES, Version.CURRENT)).localNodeId("node1").masterNodeId("node1").build()).metadata(metadata).build();
    setState(clusterService, state);
    changedInvocation.acquire();
    assertThat(changedInvocation.availablePermits(), equalTo(0));
    calculateInvocation.acquire();
    assertThat(calculateInvocation.availablePermits(), equalTo(0));
    updateInvocation.acquire();
    assertThat(updateInvocation.availablePermits(), equalTo(0));
    assertThat(finishInvocation.availablePermits(), equalTo(0));
    assertThat(addedListener.get(), notNullValue());
    assertThat(changedListener.get(), notNullValue());
    assertThat(removedListener.get(), notNullValue());
    prevState = state;
    state = ClusterState.builder(prevState).metadata(Metadata.builder(state.metadata()).removeTemplate("user_template")).build();
    setState(clusterService, state);
    // Make sure that update wasn't invoked since we are still running
    changedInvocation.acquire();
    assertThat(changedInvocation.availablePermits(), equalTo(0));
    assertThat(calculateInvocation.availablePermits(), equalTo(0));
    assertThat(updateInvocation.availablePermits(), equalTo(0));
    assertThat(finishInvocation.availablePermits(), equalTo(0));
    addedListener.getAndSet(null).onResponse(new AcknowledgedResponse(true) {
    });
    changedListener.getAndSet(null).onResponse(new AcknowledgedResponse(true) {
    });
    removedListener.getAndSet(null).onResponse(new AcknowledgedResponse(true) {
    });
    // 3 upgrades should be completed, in addition to the final calculate
    finishInvocation.acquire(3);
    assertThat(finishInvocation.availablePermits(), equalTo(0));
    calculateInvocation.acquire();
    assertThat(calculateInvocation.availablePermits(), equalTo(0));
    setState(clusterService, state);
    // Make sure that update was called this time since we are no longer running
    changedInvocation.acquire();
    assertThat(changedInvocation.availablePermits(), equalTo(0));
    calculateInvocation.acquire();
    assertThat(calculateInvocation.availablePermits(), equalTo(0));
    updateInvocation.acquire();
    assertThat(updateInvocation.availablePermits(), equalTo(0));
    assertThat(finishInvocation.availablePermits(), equalTo(0));
    addedListener.getAndSet(null).onFailure(new RuntimeException("test - ignore"));
    changedListener.getAndSet(null).onFailure(new RuntimeException("test - ignore"));
    removedListener.getAndSet(null).onFailure(new RuntimeException("test - ignore"));
    finishInvocation.acquire(3);
    assertThat(finishInvocation.availablePermits(), equalTo(0));
    calculateInvocation.acquire();
    assertThat(calculateInvocation.availablePermits(), equalTo(0));
    setState(clusterService, state);
    // Make sure that update wasn't called this time since the index template metadata didn't change
    changedInvocation.acquire();
    assertThat(changedInvocation.availablePermits(), equalTo(0));
    assertThat(calculateInvocation.availablePermits(), equalTo(0));
    assertThat(updateInvocation.availablePermits(), equalTo(0));
    assertThat(finishInvocation.availablePermits(), equalTo(0));
}
Also used : ImmutableOpenMap(org.opensearch.common.collect.ImmutableOpenMap) Arrays(java.util.Arrays) PutIndexTemplateRequest(org.opensearch.action.admin.indices.template.put.PutIndexTemplateRequest) TestThreadPool(org.opensearch.threadpool.TestThreadPool) Version(org.opensearch.Version) ClusterServiceUtils.setState(org.opensearch.test.ClusterServiceUtils.setState) CoreMatchers.startsWith(org.hamcrest.CoreMatchers.startsWith) ThreadContext(org.opensearch.common.util.concurrent.ThreadContext) DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) After(org.junit.After) Map(java.util.Map) Mockito.doAnswer(org.mockito.Mockito.doAnswer) ActionListener(org.opensearch.action.ActionListener) DeleteIndexTemplateRequest(org.opensearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest) Client(org.opensearch.client.Client) AdminClient(org.opensearch.client.AdminClient) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) OpenSearchTestCase(org.opensearch.test.OpenSearchTestCase) Set(java.util.Set) DiscoveryNodeRole(org.opensearch.cluster.node.DiscoveryNodeRole) Collectors(java.util.stream.Collectors) Tuple(org.opensearch.common.collect.Tuple) List(java.util.List) BytesArray(org.opensearch.common.bytes.BytesArray) Matchers.equalTo(org.hamcrest.Matchers.equalTo) Optional(java.util.Optional) Mockito.any(org.mockito.Mockito.any) Matchers.containsString(org.hamcrest.Matchers.containsString) Mockito.mock(org.mockito.Mockito.mock) IntStream(java.util.stream.IntStream) DiscoveryNodes(org.opensearch.cluster.node.DiscoveryNodes) BytesReference(org.opensearch.common.bytes.BytesReference) ThreadPool(org.opensearch.threadpool.ThreadPool) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) AtomicReference(java.util.concurrent.atomic.AtomicReference) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ClusterState(org.opensearch.cluster.ClusterState) Matchers.hasSize(org.hamcrest.Matchers.hasSize) CoreMatchers.nullValue(org.hamcrest.CoreMatchers.nullValue) Before(org.junit.Before) Collections.emptyMap(java.util.Collections.emptyMap) Matchers.empty(org.hamcrest.Matchers.empty) ClusterServiceUtils.createClusterService(org.opensearch.test.ClusterServiceUtils.createClusterService) Semaphore(java.util.concurrent.Semaphore) Mockito.when(org.mockito.Mockito.when) AcknowledgedResponse(org.opensearch.action.support.master.AcknowledgedResponse) IndicesAdminClient(org.opensearch.client.IndicesAdminClient) ClusterService(org.opensearch.cluster.service.ClusterService) Collections(java.util.Collections) ClusterChangedEvent(org.opensearch.cluster.ClusterChangedEvent) DiscoveryNode(org.opensearch.cluster.node.DiscoveryNode) Set(java.util.Set) HashSet(java.util.HashSet) PutIndexTemplateRequest(org.opensearch.action.admin.indices.template.put.PutIndexTemplateRequest) IndicesAdminClient(org.opensearch.client.IndicesAdminClient) ClusterChangedEvent(org.opensearch.cluster.ClusterChangedEvent) Semaphore(java.util.concurrent.Semaphore) Matchers.containsString(org.hamcrest.Matchers.containsString) DeleteIndexTemplateRequest(org.opensearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest) ImmutableOpenMap(org.opensearch.common.collect.ImmutableOpenMap) Client(org.opensearch.client.Client) AdminClient(org.opensearch.client.AdminClient) IndicesAdminClient(org.opensearch.client.IndicesAdminClient) BytesReference(org.opensearch.common.bytes.BytesReference) ClusterState(org.opensearch.cluster.ClusterState) AcknowledgedResponse(org.opensearch.action.support.master.AcknowledgedResponse) AtomicReference(java.util.concurrent.atomic.AtomicReference) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ActionListener(org.opensearch.action.ActionListener) ImmutableOpenMap(org.opensearch.common.collect.ImmutableOpenMap) Map(java.util.Map) HashMap(java.util.HashMap) Collections.emptyMap(java.util.Collections.emptyMap) Tuple(org.opensearch.common.collect.Tuple) AdminClient(org.opensearch.client.AdminClient) IndicesAdminClient(org.opensearch.client.IndicesAdminClient)

Aggregations

DeleteIndexTemplateRequest (org.opensearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest)9 HashMap (java.util.HashMap)5 PutIndexTemplateRequest (org.opensearch.client.indices.PutIndexTemplateRequest)5 AcknowledgedResponse (org.opensearch.action.support.master.AcknowledgedResponse)4 GetIndexTemplatesRequest (org.opensearch.client.indices.GetIndexTemplatesRequest)4 Matchers.containsString (org.hamcrest.Matchers.containsString)3 ActionListener (org.opensearch.action.ActionListener)3 IndicesAliasesRequest (org.opensearch.action.admin.indices.alias.IndicesAliasesRequest)3 GetAliasesRequest (org.opensearch.action.admin.indices.alias.get.GetAliasesRequest)3 ClearIndicesCacheRequest (org.opensearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest)3 DeleteIndexRequest (org.opensearch.action.admin.indices.delete.DeleteIndexRequest)3 FlushRequest (org.opensearch.action.admin.indices.flush.FlushRequest)3 ForceMergeRequest (org.opensearch.action.admin.indices.forcemerge.ForceMergeRequest)3 OpenIndexRequest (org.opensearch.action.admin.indices.open.OpenIndexRequest)3 RefreshRequest (org.opensearch.action.admin.indices.refresh.RefreshRequest)3 GetSettingsRequest (org.opensearch.action.admin.indices.settings.get.GetSettingsRequest)3 UpdateSettingsRequest (org.opensearch.action.admin.indices.settings.put.UpdateSettingsRequest)3 PutIndexTemplateRequest (org.opensearch.action.admin.indices.template.put.PutIndexTemplateRequest)3 ValidateQueryRequest (org.opensearch.action.admin.indices.validate.query.ValidateQueryRequest)3 AnalyzeRequest (org.opensearch.client.indices.AnalyzeRequest)3