Skip to content

Commit 37a997a

Browse files
authored
Remove include_type_name parameter from REST layer (#48632)
This commit removes support for the include_type_name parameter from all REST actions that receive or return mapping configurations. Relates to #41059
1 parent d92f362 commit 37a997a

File tree

39 files changed

+85
-829
lines changed

39 files changed

+85
-829
lines changed

client/rest-high-level/src/test/java/org/elasticsearch/client/indices/GetFieldMappingsResponseTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,5 @@ private static void toXContent(GetFieldMappingsResponse response, XContentBuilde
8888
}
8989
builder.endObject();
9090
}
91+
9192
}

client/rest-high-level/src/test/java/org/elasticsearch/client/indices/rollover/RolloverResponseTests.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@
2525
import org.elasticsearch.action.admin.indices.rollover.MaxSizeCondition;
2626
import org.elasticsearch.common.unit.ByteSizeValue;
2727
import org.elasticsearch.common.unit.TimeValue;
28-
import org.elasticsearch.common.xcontent.ToXContent;
2928
import org.elasticsearch.common.xcontent.XContentBuilder;
3029
import org.elasticsearch.test.ESTestCase;
31-
import org.elasticsearch.rest.BaseRestHandler;
32-
import org.elasticsearch.common.xcontent.ToXContent.Params;
3330

3431
import java.io.IOException;
3532
import java.util.ArrayList;
@@ -38,7 +35,6 @@
3835
import java.util.Map;
3936
import java.util.function.Predicate;
4037
import java.util.function.Supplier;
41-
import java.util.Collections;
4238

4339
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester;
4440

@@ -83,8 +79,6 @@ private Predicate<String> getRandomFieldsExcludeFilter() {
8379
}
8480

8581
private static void toXContent(RolloverResponse response, XContentBuilder builder) throws IOException {
86-
Params params = new ToXContent.MapParams(
87-
Collections.singletonMap(BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER, "false"));
8882
org.elasticsearch.action.admin.indices.rollover.RolloverResponse serverResponse =
8983
new org.elasticsearch.action.admin.indices.rollover.RolloverResponse(
9084
response.getOldIndex(),
@@ -95,6 +89,6 @@ private static void toXContent(RolloverResponse response, XContentBuilder builde
9589
response.isAcknowledged(),
9690
response.isShardsAcknowledged()
9791
);
98-
serverResponse.toXContent(builder, params);
92+
serverResponse.toXContent(builder, null);
9993
}
10094
}

docs/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,14 +550,12 @@ for (int i = 0; i < 5; i++) {
550550
buildRestTests.setups['library'] = '''
551551
- do:
552552
indices.create:
553-
include_type_name: true
554553
index: library
555554
body:
556555
settings:
557556
number_of_shards: 1
558557
number_of_replicas: 1
559558
mappings:
560-
book:
561559
properties:
562560
name:
563561
type: text

docs/reference/mapping/removal_of_types.asciidoc

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ See some examples of interactions with Elasticsearch with this option set to `fa
456456

457457
[source,console]
458458
--------------------------------------------------
459-
PUT index?include_type_name=false
459+
PUT index
460460
{
461461
"mappings": {
462462
"properties": { <1>
@@ -472,7 +472,7 @@ PUT index?include_type_name=false
472472

473473
[source,console]
474474
--------------------------------------------------
475-
PUT index/_mappings?include_type_name=false
475+
PUT index/_mappings
476476
{
477477
"properties": { <1>
478478
"bar": {
@@ -487,7 +487,7 @@ PUT index/_mappings?include_type_name=false
487487

488488
[source,console]
489489
--------------------------------------------------
490-
GET index/_mappings?include_type_name=false
490+
GET index/_mappings
491491
--------------------------------------------------
492492
// TEST[continued]
493493

@@ -622,28 +622,12 @@ PUT _template/template1
622622
}
623623
}
624624
625-
PUT _template/template2?include_type_name=true
625+
PUT index-1-01
626626
{
627-
"index_patterns":[ "index-2-*" ],
628627
"mappings": {
629-
"type": {
630-
"properties": {
631-
"foo": {
632-
"type": "keyword"
633-
}
634-
}
635-
}
636-
}
637-
}
638-
639-
PUT index-1-01?include_type_name=true
640-
{
641-
"mappings": {
642-
"type": {
643-
"properties": {
644-
"bar": {
645-
"type": "long"
646-
}
628+
"properties": {
629+
"bar": {
630+
"type": "long"
647631
}
648632
}
649633
}

docs/reference/mapping/types/date_nanos.asciidoc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,12 @@ For instance:
3030

3131
[source,console]
3232
--------------------------------------------------
33-
PUT my_index?include_type_name=true
33+
PUT my_index
3434
{
3535
"mappings": {
36-
"_doc": {
37-
"properties": {
38-
"date": {
39-
"type": "date_nanos" <1>
40-
}
36+
"properties": {
37+
"date": {
38+
"type": "date_nanos" <1>
4139
}
4240
}
4341
}

rest-api-spec/src/main/resources/rest-api-spec/test/field_caps/10_basic.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ setup:
152152

153153
- do:
154154
indices.create:
155-
include_type_name: false
156155
index: test_nanos
157156
body:
158157
mappings:

rest-api-spec/src/main/resources/rest-api-spec/test/indices.create/10_basic.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,3 @@
119119
properties:
120120
"":
121121
type: keyword
122-
123-
---
124-
"Create index with explicit _doc type":
125-
126-
- do:
127-
catch: bad_request
128-
indices.create:
129-
index: test_index
130-
body:
131-
mappings:
132-
_doc:
133-
properties:
134-
field:
135-
type: keyword
136-
137-
- match: { error.type: "illegal_argument_exception" }
138-
- match: { error.reason: "The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true." }

rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_template/11_basic_with_types.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_template/10_basic.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -229,21 +229,3 @@
229229
indices.put_template:
230230
name: test
231231
body: {}
232-
233-
---
234-
"Put template with explicit _doc type":
235-
236-
- do:
237-
catch: bad_request
238-
indices.put_template:
239-
name: test
240-
body:
241-
index_patterns: test-*
242-
mappings:
243-
_doc:
244-
properties:
245-
field:
246-
type: keyword
247-
248-
- match: { error.type: "illegal_argument_exception" }
249-
- match: { error.reason: "The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true." }

rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_template/11_basic_with_types.yml

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)