Search in sources :

Example 1 with DELETE

use of org.opensearch.rest.RestRequest.Method.DELETE in project OpenSearch by opensearch-project.

the class RestDeleteIndexAction method prepareRequest.

@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
    deleteIndexRequest.timeout(request.paramAsTime("timeout", deleteIndexRequest.timeout()));
    deleteIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteIndexRequest.masterNodeTimeout()));
    deleteIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, deleteIndexRequest.indicesOptions()));
    return channel -> client.admin().indices().delete(deleteIndexRequest, new RestToXContentListener<>(channel));
}
Also used : DELETE(org.opensearch.rest.RestRequest.Method.DELETE) List(java.util.List) DeleteIndexRequest(org.opensearch.action.admin.indices.delete.DeleteIndexRequest) NodeClient(org.opensearch.client.node.NodeClient) RestToXContentListener(org.opensearch.rest.action.RestToXContentListener) Collections.unmodifiableList(java.util.Collections.unmodifiableList) RestRequest(org.opensearch.rest.RestRequest) Arrays.asList(java.util.Arrays.asList) IOException(java.io.IOException) IndicesOptions(org.opensearch.action.support.IndicesOptions) BaseRestHandler(org.opensearch.rest.BaseRestHandler) Strings(org.opensearch.common.Strings) DeleteIndexRequest(org.opensearch.action.admin.indices.delete.DeleteIndexRequest)

Aggregations

IOException (java.io.IOException)1 Arrays.asList (java.util.Arrays.asList)1 Collections.unmodifiableList (java.util.Collections.unmodifiableList)1 List (java.util.List)1 DeleteIndexRequest (org.opensearch.action.admin.indices.delete.DeleteIndexRequest)1 IndicesOptions (org.opensearch.action.support.IndicesOptions)1 NodeClient (org.opensearch.client.node.NodeClient)1 Strings (org.opensearch.common.Strings)1 BaseRestHandler (org.opensearch.rest.BaseRestHandler)1 RestRequest (org.opensearch.rest.RestRequest)1 DELETE (org.opensearch.rest.RestRequest.Method.DELETE)1 RestToXContentListener (org.opensearch.rest.action.RestToXContentListener)1