Skip to content

Commit d9e9094

Browse files
authored
Deprecate the update_all_types option. (#28284)
This option makes no sense on indices that have only one type, which is enforced since 6.0.
1 parent 029c1ff commit d9e9094

File tree

6 files changed

+30
-4
lines changed

6 files changed

+30
-4
lines changed

server/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,9 @@ public boolean updateAllTypes() {
440440
return updateAllTypes;
441441
}
442442

443-
/** See {@link #updateAllTypes()} */
443+
/** See {@link #updateAllTypes()}
444+
* @deprecated useless with 6.x indices which may only have one type */
445+
@Deprecated
444446
public CreateIndexRequest updateAllTypes(boolean updateAllTypes) {
445447
this.updateAllTypes = updateAllTypes;
446448
return this;

server/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequestBuilder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ public CreateIndexRequestBuilder setSource(XContentBuilder source) {
239239
return this;
240240
}
241241

242-
/** True if all fields that span multiple types should be updated, false otherwise */
242+
/** True if all fields that span multiple types should be updated, false otherwise
243+
* @deprecated useless with 6.x indices which may only have one type */
244+
@Deprecated
243245
public CreateIndexRequestBuilder setUpdateAllTypes(boolean updateAllTypes) {
244246
request.updateAllTypes(updateAllTypes);
245247
return this;

server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,11 @@ public boolean updateAllTypes() {
296296
return updateAllTypes;
297297
}
298298

299-
/** See {@link #updateAllTypes()} */
299+
/**
300+
* True if all fields that span multiple types should be updated, false otherwise.
301+
* @deprecated useless with 6.x indices which may only have one type
302+
*/
303+
@Deprecated
300304
public PutMappingRequest updateAllTypes(boolean updateAllTypes) {
301305
this.updateAllTypes = updateAllTypes;
302306
return this;

server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequestBuilder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ public PutMappingRequestBuilder setSource(Object... source) {
9898
return this;
9999
}
100100

101-
/** True if all fields that span multiple types should be updated, false otherwise */
101+
/** True if all fields that span multiple types should be updated, false otherwise
102+
* @deprecated useless with 6.x indices which may only have one type */
103+
@Deprecated
102104
public PutMappingRequestBuilder setUpdateAllTypes(boolean updateAllTypes) {
103105
request.updateAllTypes(updateAllTypes);
104106
return this;

server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
2424
import org.elasticsearch.action.support.ActiveShardCount;
2525
import org.elasticsearch.client.node.NodeClient;
26+
import org.elasticsearch.common.logging.DeprecationLogger;
27+
import org.elasticsearch.common.logging.Loggers;
2628
import org.elasticsearch.common.settings.Settings;
2729
import org.elasticsearch.common.xcontent.XContentBuilder;
2830
import org.elasticsearch.rest.BaseRestHandler;
@@ -33,6 +35,9 @@
3335
import java.io.IOException;
3436

3537
public class RestCreateIndexAction extends BaseRestHandler {
38+
39+
private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(Loggers.getLogger(RestCreateIndexAction.class));
40+
3641
public RestCreateIndexAction(Settings settings, RestController controller) {
3742
super(settings);
3843
controller.registerHandler(RestRequest.Method.PUT, "/{index}", this);
@@ -49,6 +54,9 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
4954
if (request.hasContent()) {
5055
createIndexRequest.source(request.content(), request.getXContentType());
5156
}
57+
if (request.hasParam("update_all_types")) {
58+
DEPRECATION_LOGGER.deprecated("[update_all_types] is deprecated since indices may not have more than one type anymore");
59+
}
5260
createIndexRequest.updateAllTypes(request.paramAsBoolean("update_all_types", false));
5361
createIndexRequest.timeout(request.paramAsTime("timeout", createIndexRequest.timeout()));
5462
createIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", createIndexRequest.masterNodeTimeout()));

server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import org.elasticsearch.action.support.IndicesOptions;
2424
import org.elasticsearch.client.node.NodeClient;
2525
import org.elasticsearch.common.Strings;
26+
import org.elasticsearch.common.logging.DeprecationLogger;
27+
import org.elasticsearch.common.logging.Loggers;
2628
import org.elasticsearch.common.settings.Settings;
2729
import org.elasticsearch.rest.BaseRestHandler;
2830
import org.elasticsearch.rest.RestController;
@@ -36,6 +38,9 @@
3638
import static org.elasticsearch.rest.RestRequest.Method.PUT;
3739

3840
public class RestPutMappingAction extends BaseRestHandler {
41+
42+
private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(Loggers.getLogger(RestPutMappingAction.class));
43+
3944
public RestPutMappingAction(Settings settings, RestController controller) {
4045
super(settings);
4146
controller.registerHandler(PUT, "/{index}/_mapping/", this);
@@ -70,6 +75,9 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
7075
PutMappingRequest putMappingRequest = putMappingRequest(Strings.splitStringByCommaToArray(request.param("index")));
7176
putMappingRequest.type(request.param("type"));
7277
putMappingRequest.source(request.requiredContent(), request.getXContentType());
78+
if (request.hasParam("update_all_types")) {
79+
DEPRECATION_LOGGER.deprecated("[update_all_types] is deprecated since indices may not have more than one type anymore");
80+
}
7381
putMappingRequest.updateAllTypes(request.paramAsBoolean("update_all_types", false));
7482
putMappingRequest.timeout(request.paramAsTime("timeout", putMappingRequest.timeout()));
7583
putMappingRequest.masterNodeTimeout(request.paramAsTime("master_timeout", putMappingRequest.masterNodeTimeout()));

0 commit comments

Comments
 (0)