org.opensearch.action.search.DeleteSearchPipelineTransportAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of opensearch Show documentation
Show all versions of opensearch Show documentation
OpenSearch subproject :server
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
package org.opensearch.action.search;
import org.opensearch.action.support.ActionFilters;
import org.opensearch.action.support.clustermanager.TransportClusterManagerNodeAction;
import org.opensearch.action.support.master.AcknowledgedResponse;
import org.opensearch.cluster.ClusterState;
import org.opensearch.cluster.block.ClusterBlockException;
import org.opensearch.cluster.block.ClusterBlockLevel;
import org.opensearch.cluster.metadata.IndexNameExpressionResolver;
import org.opensearch.common.inject.Inject;
import org.opensearch.core.action.ActionListener;
import org.opensearch.core.common.io.stream.StreamInput;
import org.opensearch.search.pipeline.SearchPipelineService;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.TransportService;
import java.io.IOException;
/**
* Perform the action of deleting a search pipeline
*
* @opensearch.internal
*/
public class DeleteSearchPipelineTransportAction extends TransportClusterManagerNodeAction<
DeleteSearchPipelineRequest,
AcknowledgedResponse> {
private final SearchPipelineService searchPipelineService;
@Inject
public DeleteSearchPipelineTransportAction(
ThreadPool threadPool,
SearchPipelineService searchPipelineService,
TransportService transportService,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver
) {
super(
DeleteSearchPipelineAction.NAME,
transportService,
searchPipelineService.getClusterService(),
threadPool,
actionFilters,
DeleteSearchPipelineRequest::new,
indexNameExpressionResolver
);
this.searchPipelineService = searchPipelineService;
}
@Override
protected String executor() {
return ThreadPool.Names.SAME;
}
@Override
protected AcknowledgedResponse read(StreamInput in) throws IOException {
return new AcknowledgedResponse(in);
}
@Override
protected void clusterManagerOperation(
DeleteSearchPipelineRequest request,
ClusterState state,
ActionListener listener
) throws Exception {
searchPipelineService.deletePipeline(request, listener);
}
@Override
protected ClusterBlockException checkBlock(DeleteSearchPipelineRequest request, ClusterState state) {
return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_WRITE);
}
}