[Remove] TypesExist Action (#3139)
The types exist transport action can be removed now that the TransportClient has been removed and types support has been removed. Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
This commit is contained in:
parent
ae4c612580
commit
15f035b479
|
@ -37,7 +37,6 @@ import org.opensearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequ
|
|||
import org.opensearch.action.admin.indices.alias.exists.AliasesExistRequestBuilder;
|
||||
import org.opensearch.action.admin.indices.alias.get.GetAliasesRequestBuilder;
|
||||
import org.opensearch.action.admin.indices.cache.clear.ClearIndicesCacheRequestBuilder;
|
||||
import org.opensearch.action.admin.indices.exists.types.TypesExistsRequestBuilder;
|
||||
import org.opensearch.action.admin.indices.flush.FlushRequestBuilder;
|
||||
import org.opensearch.action.admin.indices.forcemerge.ForceMergeRequestBuilder;
|
||||
import org.opensearch.action.admin.indices.mapping.get.GetFieldMappingsRequestBuilder;
|
||||
|
@ -99,7 +98,6 @@ public class IndicesOptionsIntegrationIT extends OpenSearchIntegTestCase {
|
|||
verify(refreshBuilder("test1", "test2"), true);
|
||||
verify(validateQuery("test1", "test2"), true);
|
||||
verify(aliasExists("test1", "test2"), true);
|
||||
verify(typesExists("test1", "test2"), true);
|
||||
verify(getAliases("test1", "test2"), true);
|
||||
verify(getFieldMapping("test1", "test2"), true);
|
||||
verify(getMapping("test1", "test2"), true);
|
||||
|
@ -116,7 +114,6 @@ public class IndicesOptionsIntegrationIT extends OpenSearchIntegTestCase {
|
|||
verify(refreshBuilder("test1", "test2").setIndicesOptions(options), true);
|
||||
verify(validateQuery("test1", "test2").setIndicesOptions(options), true);
|
||||
verify(aliasExists("test1", "test2").setIndicesOptions(options), true);
|
||||
verify(typesExists("test1", "test2").setIndicesOptions(options), true);
|
||||
verify(getAliases("test1", "test2").setIndicesOptions(options), true);
|
||||
verify(getFieldMapping("test1", "test2").setIndicesOptions(options), true);
|
||||
verify(getMapping("test1", "test2").setIndicesOptions(options), true);
|
||||
|
@ -133,7 +130,6 @@ public class IndicesOptionsIntegrationIT extends OpenSearchIntegTestCase {
|
|||
verify(refreshBuilder("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(validateQuery("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(aliasExists("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(typesExists("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(getAliases("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(getFieldMapping("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(getMapping("test1", "test2").setIndicesOptions(options), false);
|
||||
|
@ -151,7 +147,6 @@ public class IndicesOptionsIntegrationIT extends OpenSearchIntegTestCase {
|
|||
verify(refreshBuilder("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(validateQuery("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(aliasExists("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(typesExists("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(getAliases("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(getFieldMapping("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(getMapping("test1", "test2").setIndicesOptions(options), false);
|
||||
|
@ -178,7 +173,6 @@ public class IndicesOptionsIntegrationIT extends OpenSearchIntegTestCase {
|
|||
verify(refreshBuilder("test1").setIndicesOptions(options), true);
|
||||
verify(validateQuery("test1").setIndicesOptions(options), true);
|
||||
verify(aliasExists("test1").setIndicesOptions(options), true);
|
||||
verify(typesExists("test1").setIndicesOptions(options), true);
|
||||
verify(getAliases("test1").setIndicesOptions(options), true);
|
||||
verify(getFieldMapping("test1").setIndicesOptions(options), true);
|
||||
verify(getMapping("test1").setIndicesOptions(options), true);
|
||||
|
@ -201,7 +195,6 @@ public class IndicesOptionsIntegrationIT extends OpenSearchIntegTestCase {
|
|||
verify(refreshBuilder("test1").setIndicesOptions(options), false);
|
||||
verify(validateQuery("test1").setIndicesOptions(options), false);
|
||||
verify(aliasExists("test1").setIndicesOptions(options), false);
|
||||
verify(typesExists("test1").setIndicesOptions(options), false);
|
||||
verify(getAliases("test1").setIndicesOptions(options), false);
|
||||
verify(getFieldMapping("test1").setIndicesOptions(options), false);
|
||||
verify(getMapping("test1").setIndicesOptions(options), false);
|
||||
|
@ -221,7 +214,6 @@ public class IndicesOptionsIntegrationIT extends OpenSearchIntegTestCase {
|
|||
verify(refreshBuilder("test1").setIndicesOptions(options), false);
|
||||
verify(validateQuery("test1").setIndicesOptions(options), false);
|
||||
verify(aliasExists("test1").setIndicesOptions(options), false);
|
||||
verify(typesExists("test1").setIndicesOptions(options), false);
|
||||
verify(getAliases("test1").setIndicesOptions(options), false);
|
||||
verify(getFieldMapping("test1").setIndicesOptions(options), false);
|
||||
verify(getMapping("test1").setIndicesOptions(options), false);
|
||||
|
@ -240,7 +232,6 @@ public class IndicesOptionsIntegrationIT extends OpenSearchIntegTestCase {
|
|||
verify(refreshBuilder("test1").setIndicesOptions(options), true);
|
||||
verify(validateQuery("test1").setIndicesOptions(options), true);
|
||||
verify(aliasExists("test1").setIndicesOptions(options), true);
|
||||
verify(typesExists("test1").setIndicesOptions(options), true);
|
||||
verify(getAliases("test1").setIndicesOptions(options), true);
|
||||
verify(getFieldMapping("test1").setIndicesOptions(options), true);
|
||||
verify(getMapping("test1").setIndicesOptions(options), true);
|
||||
|
@ -263,7 +254,6 @@ public class IndicesOptionsIntegrationIT extends OpenSearchIntegTestCase {
|
|||
verify(refreshBuilder("test1").setIndicesOptions(options), false);
|
||||
verify(validateQuery("test1").setIndicesOptions(options), false);
|
||||
verify(aliasExists("test1").setIndicesOptions(options), false);
|
||||
verify(typesExists("test1").setIndicesOptions(options), false);
|
||||
verify(getAliases("test1").setIndicesOptions(options), false);
|
||||
verify(getFieldMapping("test1").setIndicesOptions(options), false);
|
||||
verify(getMapping("test1").setIndicesOptions(options), false);
|
||||
|
@ -282,7 +272,6 @@ public class IndicesOptionsIntegrationIT extends OpenSearchIntegTestCase {
|
|||
verify(refreshBuilder("test1").setIndicesOptions(options), false);
|
||||
verify(validateQuery("test1").setIndicesOptions(options), false);
|
||||
verify(aliasExists("test1").setIndicesOptions(options), false);
|
||||
verify(typesExists("test1").setIndicesOptions(options), false);
|
||||
verify(getAliases("test1").setIndicesOptions(options), false);
|
||||
verify(getFieldMapping("test1").setIndicesOptions(options), false);
|
||||
verify(getMapping("test1").setIndicesOptions(options), false);
|
||||
|
@ -336,7 +325,6 @@ public class IndicesOptionsIntegrationIT extends OpenSearchIntegTestCase {
|
|||
verify(refreshBuilder(indices), false);
|
||||
verify(validateQuery(indices), true);
|
||||
verify(aliasExists(indices), false);
|
||||
verify(typesExists(indices), false);
|
||||
verify(getAliases(indices), false);
|
||||
verify(getFieldMapping(indices), false);
|
||||
verify(getMapping(indices), false);
|
||||
|
@ -354,7 +342,6 @@ public class IndicesOptionsIntegrationIT extends OpenSearchIntegTestCase {
|
|||
verify(refreshBuilder(indices).setIndicesOptions(options), false);
|
||||
verify(validateQuery(indices).setIndicesOptions(options), false);
|
||||
verify(aliasExists(indices).setIndicesOptions(options), false);
|
||||
verify(typesExists(indices).setIndicesOptions(options), false);
|
||||
verify(getAliases(indices).setIndicesOptions(options), false);
|
||||
verify(getFieldMapping(indices).setIndicesOptions(options), false);
|
||||
verify(getMapping(indices).setIndicesOptions(options), false);
|
||||
|
@ -375,7 +362,6 @@ public class IndicesOptionsIntegrationIT extends OpenSearchIntegTestCase {
|
|||
verify(refreshBuilder(indices), false);
|
||||
verify(validateQuery(indices), false);
|
||||
verify(aliasExists(indices), false);
|
||||
verify(typesExists(indices), false);
|
||||
verify(getAliases(indices), false);
|
||||
verify(getFieldMapping(indices), false);
|
||||
verify(getMapping(indices), false);
|
||||
|
@ -393,7 +379,6 @@ public class IndicesOptionsIntegrationIT extends OpenSearchIntegTestCase {
|
|||
verify(refreshBuilder(indices), false);
|
||||
verify(validateQuery(indices), true);
|
||||
verify(aliasExists(indices), false);
|
||||
verify(typesExists(indices), false);
|
||||
verify(getAliases(indices), false);
|
||||
verify(getFieldMapping(indices), false);
|
||||
verify(getMapping(indices), false);
|
||||
|
@ -411,7 +396,6 @@ public class IndicesOptionsIntegrationIT extends OpenSearchIntegTestCase {
|
|||
verify(refreshBuilder(indices).setIndicesOptions(options), false);
|
||||
verify(validateQuery(indices).setIndicesOptions(options), false);
|
||||
verify(aliasExists(indices).setIndicesOptions(options), false);
|
||||
verify(typesExists(indices).setIndicesOptions(options), false);
|
||||
verify(getAliases(indices).setIndicesOptions(options), false);
|
||||
verify(getFieldMapping(indices).setIndicesOptions(options), false);
|
||||
verify(getMapping(indices).setIndicesOptions(options), false);
|
||||
|
@ -725,10 +709,6 @@ public class IndicesOptionsIntegrationIT extends OpenSearchIntegTestCase {
|
|||
return client().admin().indices().prepareAliasesExist("dummy").addIndices(indices);
|
||||
}
|
||||
|
||||
private static TypesExistsRequestBuilder typesExists(String... indices) {
|
||||
return client().admin().indices().prepareTypesExists(indices).setTypes("dummy");
|
||||
}
|
||||
|
||||
static GetAliasesRequestBuilder getAliases(String... indices) {
|
||||
return client().admin().indices().prepareGetAliases("dummy").addIndices(indices);
|
||||
}
|
||||
|
|
|
@ -137,8 +137,6 @@ import org.opensearch.action.admin.indices.delete.DeleteIndexAction;
|
|||
import org.opensearch.action.admin.indices.delete.TransportDeleteIndexAction;
|
||||
import org.opensearch.action.admin.indices.exists.indices.IndicesExistsAction;
|
||||
import org.opensearch.action.admin.indices.exists.indices.TransportIndicesExistsAction;
|
||||
import org.opensearch.action.admin.indices.exists.types.TransportTypesExistsAction;
|
||||
import org.opensearch.action.admin.indices.exists.types.TypesExistsAction;
|
||||
import org.opensearch.action.admin.indices.flush.FlushAction;
|
||||
import org.opensearch.action.admin.indices.flush.TransportFlushAction;
|
||||
import org.opensearch.action.admin.indices.forcemerge.ForceMergeAction;
|
||||
|
@ -560,7 +558,6 @@ public class ActionModule extends AbstractModule {
|
|||
actions.register(OpenIndexAction.INSTANCE, TransportOpenIndexAction.class);
|
||||
actions.register(CloseIndexAction.INSTANCE, TransportCloseIndexAction.class);
|
||||
actions.register(IndicesExistsAction.INSTANCE, TransportIndicesExistsAction.class);
|
||||
actions.register(TypesExistsAction.INSTANCE, TransportTypesExistsAction.class);
|
||||
actions.register(AddIndexBlockAction.INSTANCE, TransportAddIndexBlockAction.class);
|
||||
actions.register(GetMappingsAction.INSTANCE, TransportGetMappingsAction.class);
|
||||
actions.register(
|
||||
|
|
|
@ -1,125 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
/*
|
||||
* Modifications Copyright OpenSearch Contributors. See
|
||||
* GitHub history for details.
|
||||
*/
|
||||
|
||||
package org.opensearch.action.admin.indices.exists.types;
|
||||
|
||||
import org.opensearch.action.ActionListener;
|
||||
import org.opensearch.action.support.ActionFilters;
|
||||
import org.opensearch.action.support.master.TransportMasterNodeReadAction;
|
||||
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.cluster.metadata.MappingMetadata;
|
||||
import org.opensearch.cluster.service.ClusterService;
|
||||
import org.opensearch.common.inject.Inject;
|
||||
import org.opensearch.common.io.stream.StreamInput;
|
||||
import org.opensearch.threadpool.ThreadPool;
|
||||
import org.opensearch.transport.TransportService;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Types exists transport action.
|
||||
*/
|
||||
public class TransportTypesExistsAction extends TransportMasterNodeReadAction<TypesExistsRequest, TypesExistsResponse> {
|
||||
|
||||
@Inject
|
||||
public TransportTypesExistsAction(
|
||||
TransportService transportService,
|
||||
ClusterService clusterService,
|
||||
ThreadPool threadPool,
|
||||
ActionFilters actionFilters,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver
|
||||
) {
|
||||
super(
|
||||
TypesExistsAction.NAME,
|
||||
transportService,
|
||||
clusterService,
|
||||
threadPool,
|
||||
actionFilters,
|
||||
TypesExistsRequest::new,
|
||||
indexNameExpressionResolver
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String executor() {
|
||||
// lightweight check
|
||||
return ThreadPool.Names.SAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TypesExistsResponse read(StreamInput in) throws IOException {
|
||||
return new TypesExistsResponse(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClusterBlockException checkBlock(TypesExistsRequest request, ClusterState state) {
|
||||
return state.blocks()
|
||||
.indicesBlockedException(ClusterBlockLevel.METADATA_READ, indexNameExpressionResolver.concreteIndexNames(state, request));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void masterOperation(
|
||||
final TypesExistsRequest request,
|
||||
final ClusterState state,
|
||||
final ActionListener<TypesExistsResponse> listener
|
||||
) {
|
||||
String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(state, request.indicesOptions(), request.indices());
|
||||
if (concreteIndices.length == 0) {
|
||||
listener.onResponse(new TypesExistsResponse(false));
|
||||
return;
|
||||
}
|
||||
|
||||
for (String concreteIndex : concreteIndices) {
|
||||
if (!state.metadata().hasConcreteIndex(concreteIndex)) {
|
||||
listener.onResponse(new TypesExistsResponse(false));
|
||||
return;
|
||||
}
|
||||
|
||||
MappingMetadata mapping = state.metadata().getIndices().get(concreteIndex).mapping();
|
||||
if (mapping == null) {
|
||||
listener.onResponse(new TypesExistsResponse(false));
|
||||
return;
|
||||
}
|
||||
|
||||
for (String type : request.types()) {
|
||||
if (mapping.type().equals(type) == false) {
|
||||
listener.onResponse(new TypesExistsResponse(false));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
listener.onResponse(new TypesExistsResponse(true));
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
/*
|
||||
* Modifications Copyright OpenSearch Contributors. See
|
||||
* GitHub history for details.
|
||||
*/
|
||||
|
||||
package org.opensearch.action.admin.indices.exists.types;
|
||||
|
||||
import org.opensearch.action.ActionType;
|
||||
|
||||
public class TypesExistsAction extends ActionType<TypesExistsResponse> {
|
||||
|
||||
public static final TypesExistsAction INSTANCE = new TypesExistsAction();
|
||||
public static final String NAME = "indices:admin/types/exists";
|
||||
|
||||
private TypesExistsAction() {
|
||||
super(NAME, TypesExistsResponse::new);
|
||||
}
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
/*
|
||||
* Modifications Copyright OpenSearch Contributors. See
|
||||
* GitHub history for details.
|
||||
*/
|
||||
|
||||
package org.opensearch.action.admin.indices.exists.types;
|
||||
|
||||
import org.opensearch.action.ActionRequestValidationException;
|
||||
import org.opensearch.action.IndicesRequest;
|
||||
import org.opensearch.action.support.IndicesOptions;
|
||||
import org.opensearch.action.support.master.MasterNodeReadRequest;
|
||||
import org.opensearch.common.io.stream.StreamInput;
|
||||
import org.opensearch.common.io.stream.StreamOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.opensearch.action.ValidateActions.addValidationError;
|
||||
|
||||
public class TypesExistsRequest extends MasterNodeReadRequest<TypesExistsRequest> implements IndicesRequest.Replaceable {
|
||||
|
||||
private String[] indices;
|
||||
private String[] types;
|
||||
|
||||
private IndicesOptions indicesOptions = IndicesOptions.strictExpandOpen();
|
||||
|
||||
public TypesExistsRequest() {}
|
||||
|
||||
public TypesExistsRequest(String[] indices, String... types) {
|
||||
this.indices = indices;
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
public TypesExistsRequest(StreamInput in) throws IOException {
|
||||
super(in);
|
||||
indices = in.readStringArray();
|
||||
types = in.readStringArray();
|
||||
indicesOptions = IndicesOptions.readIndicesOptions(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
out.writeStringArray(indices);
|
||||
out.writeStringArray(types);
|
||||
indicesOptions.writeIndicesOptions(out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] indices() {
|
||||
return indices;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypesExistsRequest indices(String... indices) {
|
||||
this.indices = indices;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String[] types() {
|
||||
return types;
|
||||
}
|
||||
|
||||
public void types(String[] types) {
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IndicesOptions indicesOptions() {
|
||||
return indicesOptions;
|
||||
}
|
||||
|
||||
public TypesExistsRequest indicesOptions(IndicesOptions indicesOptions) {
|
||||
this.indicesOptions = indicesOptions;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionRequestValidationException validate() {
|
||||
ActionRequestValidationException validationException = null;
|
||||
if (indices == null) { // Specifying '*' via rest api results in an empty array
|
||||
validationException = addValidationError("index/indices is missing", validationException);
|
||||
}
|
||||
if (types == null || types.length == 0) {
|
||||
validationException = addValidationError("type/types is missing", validationException);
|
||||
}
|
||||
|
||||
return validationException;
|
||||
}
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
/*
|
||||
* Modifications Copyright OpenSearch Contributors. See
|
||||
* GitHub history for details.
|
||||
*/
|
||||
|
||||
package org.opensearch.action.admin.indices.exists.types;
|
||||
|
||||
import org.opensearch.action.support.IndicesOptions;
|
||||
import org.opensearch.action.support.master.MasterNodeReadOperationRequestBuilder;
|
||||
import org.opensearch.client.OpenSearchClient;
|
||||
import org.opensearch.common.Strings;
|
||||
|
||||
/**
|
||||
* A builder for {@link TypesExistsRequest}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class TypesExistsRequestBuilder extends MasterNodeReadOperationRequestBuilder<
|
||||
TypesExistsRequest,
|
||||
TypesExistsResponse,
|
||||
TypesExistsRequestBuilder> {
|
||||
|
||||
/**
|
||||
* @param indices What indices to check for types
|
||||
*/
|
||||
public TypesExistsRequestBuilder(OpenSearchClient client, TypesExistsAction action, String... indices) {
|
||||
super(client, action, new TypesExistsRequest(indices, Strings.EMPTY_ARRAY));
|
||||
}
|
||||
|
||||
TypesExistsRequestBuilder(OpenSearchClient client, TypesExistsAction action) {
|
||||
super(client, action, new TypesExistsRequest());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param indices What indices to check for types
|
||||
*/
|
||||
public TypesExistsRequestBuilder setIndices(String[] indices) {
|
||||
request.indices(indices);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param types The types to check if they exist
|
||||
*/
|
||||
public TypesExistsRequestBuilder setTypes(String... types) {
|
||||
request.types(types);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param indicesOptions Specifies how to resolve indices that aren't active / ready and indices wildcard expressions
|
||||
*/
|
||||
public TypesExistsRequestBuilder setIndicesOptions(IndicesOptions indicesOptions) {
|
||||
request.indicesOptions(indicesOptions);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
/*
|
||||
* Modifications Copyright OpenSearch Contributors. See
|
||||
* GitHub history for details.
|
||||
*/
|
||||
|
||||
package org.opensearch.action.admin.indices.exists.types;
|
||||
|
||||
import org.opensearch.action.ActionResponse;
|
||||
import org.opensearch.common.io.stream.StreamInput;
|
||||
import org.opensearch.common.io.stream.StreamOutput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Whether all of the existed types exist.
|
||||
*/
|
||||
public class TypesExistsResponse extends ActionResponse {
|
||||
|
||||
private boolean exists;
|
||||
|
||||
TypesExistsResponse(StreamInput in) throws IOException {
|
||||
super(in);
|
||||
exists = in.readBoolean();
|
||||
}
|
||||
|
||||
public TypesExistsResponse(boolean exists) {
|
||||
this.exists = exists;
|
||||
}
|
||||
|
||||
public boolean isExists() {
|
||||
return this.exists;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeBoolean(exists);
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Index Type transport handlers.
|
||||
* @deprecated types are deprecated and will be removed
|
||||
**/
|
||||
package org.opensearch.action.admin.indices.exists.types;
|
|
@ -60,9 +60,6 @@ import org.opensearch.action.admin.indices.delete.DeleteIndexRequestBuilder;
|
|||
import org.opensearch.action.admin.indices.exists.indices.IndicesExistsRequest;
|
||||
import org.opensearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder;
|
||||
import org.opensearch.action.admin.indices.exists.indices.IndicesExistsResponse;
|
||||
import org.opensearch.action.admin.indices.exists.types.TypesExistsRequest;
|
||||
import org.opensearch.action.admin.indices.exists.types.TypesExistsRequestBuilder;
|
||||
import org.opensearch.action.admin.indices.exists.types.TypesExistsResponse;
|
||||
import org.opensearch.action.admin.indices.flush.FlushRequest;
|
||||
import org.opensearch.action.admin.indices.flush.FlushRequestBuilder;
|
||||
import org.opensearch.action.admin.indices.flush.FlushResponse;
|
||||
|
@ -163,34 +160,6 @@ public interface IndicesAdminClient extends OpenSearchClient {
|
|||
*/
|
||||
IndicesExistsRequestBuilder prepareExists(String... indices);
|
||||
|
||||
/**
|
||||
* Types exists.
|
||||
*
|
||||
* @deprecated Types are deprecated and are in the process of being removed.
|
||||
* @param request The types exists request
|
||||
* @return The result future
|
||||
*/
|
||||
@Deprecated
|
||||
ActionFuture<TypesExistsResponse> typesExists(TypesExistsRequest request);
|
||||
|
||||
/**
|
||||
* Types exists.
|
||||
*
|
||||
* @deprecated Types are deprecated and are in the process of being removed.
|
||||
* @param request The types exists
|
||||
* @param listener A listener to be notified with a result
|
||||
*/
|
||||
@Deprecated
|
||||
void typesExists(TypesExistsRequest request, ActionListener<TypesExistsResponse> listener);
|
||||
|
||||
/**
|
||||
* Types exists.
|
||||
*
|
||||
* @deprecated Types are deprecated and are in the process of being removed.
|
||||
*/
|
||||
@Deprecated
|
||||
TypesExistsRequestBuilder prepareTypesExists(String... index);
|
||||
|
||||
/**
|
||||
* Indices stats.
|
||||
*/
|
||||
|
|
|
@ -192,10 +192,6 @@ import org.opensearch.action.admin.indices.exists.indices.IndicesExistsAction;
|
|||
import org.opensearch.action.admin.indices.exists.indices.IndicesExistsRequest;
|
||||
import org.opensearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder;
|
||||
import org.opensearch.action.admin.indices.exists.indices.IndicesExistsResponse;
|
||||
import org.opensearch.action.admin.indices.exists.types.TypesExistsAction;
|
||||
import org.opensearch.action.admin.indices.exists.types.TypesExistsRequest;
|
||||
import org.opensearch.action.admin.indices.exists.types.TypesExistsRequestBuilder;
|
||||
import org.opensearch.action.admin.indices.exists.types.TypesExistsResponse;
|
||||
import org.opensearch.action.admin.indices.flush.FlushAction;
|
||||
import org.opensearch.action.admin.indices.flush.FlushRequest;
|
||||
import org.opensearch.action.admin.indices.flush.FlushRequestBuilder;
|
||||
|
@ -1332,22 +1328,6 @@ public abstract class AbstractClient implements Client {
|
|||
return new IndicesExistsRequestBuilder(this, IndicesExistsAction.INSTANCE, indices);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public ActionFuture<TypesExistsResponse> typesExists(TypesExistsRequest request) {
|
||||
return execute(TypesExistsAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void typesExists(TypesExistsRequest request, ActionListener<TypesExistsResponse> listener) {
|
||||
execute(TypesExistsAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypesExistsRequestBuilder prepareTypesExists(String... index) {
|
||||
return new TypesExistsRequestBuilder(this, TypesExistsAction.INSTANCE, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<AcknowledgedResponse> aliases(final IndicesAliasesRequest request) {
|
||||
return execute(IndicesAliasesAction.INSTANCE, request);
|
||||
|
|
Loading…
Reference in New Issue