Skip to content

Commit f74bca6

Browse files
committed
Merge branch 'master' into sync-retention-leases
* master: (28 commits) Introduce retention lease serialization (elastic#37447) Update Delete Watch to allow unknown fields (elastic#37435) Make finalize step of recovery source non-blocking (elastic#37388) Update the default for include_type_name to false. (elastic#37285) Security: remove SSL settings fallback (elastic#36846) Adding mapping for hostname field (elastic#37288) Relax assertSameDocIdsOnShards assertion Reduce recovery time with compress or secure transport (elastic#36981) Implement ccr file restore (elastic#37130) Fix Eclipse specific compilation issue (elastic#37419) Performance fix. Reduce deprecation calls for the same bulk request (elastic#37415) [ML] Use String rep of Version in map for serialisation (elastic#37416) Cleanup Deadcode in Rest Tests (elastic#37418) Mute IndexShardRetentionLeaseTests.testCommit elastic#37420 unmuted test Remove unused index store in directory service Improve CloseWhileRelocatingShardsIT (elastic#37348) Fix ClusterBlock serialization and Close Index API logic after backport to 6.x (elastic#37360) Update the scroll example in the docs (elastic#37394) Update analysis.asciidoc (elastic#37404) ...
2 parents a7eb62f + 74640d0 commit f74bca6

File tree

461 files changed

+4126
-3506
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

461 files changed

+4126
-3506
lines changed

client/rest-high-level/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ integTestCluster {
105105
setting 'xpack.security.enabled', 'true'
106106
setting 'xpack.security.authc.token.enabled', 'true'
107107
// Truststore settings are not used since TLS is not enabled. Included for testing the get certificates API
108-
setting 'xpack.ssl.certificate_authorities', 'testnode.crt'
108+
setting 'xpack.security.http.ssl.certificate_authorities', 'testnode.crt'
109109
setting 'xpack.security.transport.ssl.truststore.path', 'testnode.jks'
110110
keystoreSetting 'xpack.security.transport.ssl.truststore.secure_password', 'testnode'
111111
setupCommand 'setupDummyUser',

client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesRequestConverters.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
import java.io.IOException;
5858
import java.util.Locale;
5959

60+
import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER;
61+
6062
final class IndicesRequestConverters {
6163

6264
private IndicesRequestConverters() {}
@@ -103,6 +105,7 @@ static Request createIndex(CreateIndexRequest createIndexRequest) throws IOExcep
103105
parameters.withTimeout(createIndexRequest.timeout());
104106
parameters.withMasterTimeout(createIndexRequest.masterNodeTimeout());
105107
parameters.withWaitForActiveShards(createIndexRequest.waitForActiveShards());
108+
parameters.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true");
106109

107110
request.setEntity(RequestConverters.createEntity(createIndexRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
108111
return request;
@@ -131,6 +134,7 @@ static Request putMapping(PutMappingRequest putMappingRequest) throws IOExceptio
131134
RequestConverters.Params parameters = new RequestConverters.Params(request);
132135
parameters.withTimeout(putMappingRequest.timeout());
133136
parameters.withMasterTimeout(putMappingRequest.masterNodeTimeout());
137+
parameters.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true");
134138

135139
request.setEntity(RequestConverters.createEntity(putMappingRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
136140
return request;
@@ -146,6 +150,8 @@ static Request getMappings(GetMappingsRequest getMappingsRequest) throws IOExcep
146150
parameters.withMasterTimeout(getMappingsRequest.masterNodeTimeout());
147151
parameters.withIndicesOptions(getMappingsRequest.indicesOptions());
148152
parameters.withLocal(getMappingsRequest.local());
153+
parameters.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true");
154+
149155
return request;
150156
}
151157

@@ -165,6 +171,8 @@ static Request getFieldMapping(GetFieldMappingsRequest getFieldMappingsRequest)
165171
parameters.withIndicesOptions(getFieldMappingsRequest.indicesOptions());
166172
parameters.withIncludeDefaults(getFieldMappingsRequest.includeDefaults());
167173
parameters.withLocal(getFieldMappingsRequest.local());
174+
parameters.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true");
175+
168176
return request;
169177
}
170178

@@ -357,6 +365,7 @@ static Request putTemplate(PutIndexTemplateRequest putIndexTemplateRequest) thro
357365
if (Strings.hasText(putIndexTemplateRequest.cause())) {
358366
params.putParam("cause", putIndexTemplateRequest.cause());
359367
}
368+
params.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true");
360369
request.setEntity(RequestConverters.createEntity(putIndexTemplateRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
361370
return request;
362371
}
@@ -395,6 +404,7 @@ static Request getTemplates(GetIndexTemplatesRequest getIndexTemplatesRequest) {
395404
final RequestConverters.Params params = new RequestConverters.Params(request);
396405
params.withLocal(getIndexTemplatesRequest.isLocal());
397406
params.withMasterTimeout(getIndexTemplatesRequest.getMasterNodeTimeout());
407+
params.putParam(INCLUDE_TYPE_NAME_PARAMETER, "true");
398408
return request;
399409
}
400410

client/rest-high-level/src/main/java/org/elasticsearch/client/watcher/DeleteWatchResponse.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,15 @@
2020

2121
import org.elasticsearch.common.ParseField;
2222
import org.elasticsearch.common.xcontent.ObjectParser;
23-
import org.elasticsearch.common.xcontent.ToXContentObject;
24-
import org.elasticsearch.common.xcontent.XContentBuilder;
2523
import org.elasticsearch.common.xcontent.XContentParser;
2624

2725
import java.io.IOException;
2826
import java.util.Objects;
2927

30-
public class DeleteWatchResponse implements ToXContentObject {
28+
public class DeleteWatchResponse {
3129

3230
private static final ObjectParser<DeleteWatchResponse, Void> PARSER
33-
= new ObjectParser<>("x_pack_delete_watch_response", DeleteWatchResponse::new);
31+
= new ObjectParser<>("x_pack_delete_watch_response", true, DeleteWatchResponse::new);
3432
static {
3533
PARSER.declareString(DeleteWatchResponse::setId, new ParseField("_id"));
3634
PARSER.declareLong(DeleteWatchResponse::setVersion, new ParseField("_version"));
@@ -89,15 +87,6 @@ public int hashCode() {
8987
return Objects.hash(id, version, found);
9088
}
9189

92-
@Override
93-
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
94-
return builder.startObject()
95-
.field("_id", id)
96-
.field("_version", version)
97-
.field("found", found)
98-
.endObject();
99-
}
100-
10190
public static DeleteWatchResponse fromXContent(XContentParser parser) throws IOException {
10291
return PARSER.parse(parser, null);
10392
}

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,7 @@ public void testSourceDoesNotExist() throws IOException {
255255
.put("number_of_shards", 1)
256256
.put("number_of_replicas", 0)
257257
.build();
258-
String mapping = "\"_doc\": { \"_source\": {\n" +
259-
" \"enabled\": false\n" +
260-
" } }";
258+
String mapping = "\"_source\": {\"enabled\": false}";
261259
createIndex(noSourceIndex, settings, mapping);
262260
assertEquals(
263261
RestStatus.OK,
@@ -1242,7 +1240,7 @@ public void testTermvectors() throws IOException {
12421240
.put("number_of_shards", 1)
12431241
.put("number_of_replicas", 0)
12441242
.build();
1245-
String mappings = "\"_doc\":{\"properties\":{\"field\":{\"type\":\"text\"}}}";
1243+
String mappings = "\"properties\":{\"field\":{\"type\":\"text\"}}";
12461244
createIndex(sourceIndex, settings, mappings);
12471245
assertEquals(
12481246
RestStatus.OK,
@@ -1318,7 +1316,7 @@ public void testMultiTermvectors() throws IOException {
13181316
.put("number_of_shards", 1)
13191317
.put("number_of_replicas", 0)
13201318
.build();
1321-
String mappings = "\"_doc\":{\"properties\":{\"field\":{\"type\":\"text\"}}}";
1319+
String mappings = "\"properties\":{\"field\":{\"type\":\"text\"}}";
13221320
createIndex(sourceIndex, settings, mappings);
13231321
assertEquals(
13241322
RestStatus.OK,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ public void testGetIndex() throws IOException {
341341
.put(SETTING_NUMBER_OF_SHARDS, 1)
342342
.put(SETTING_NUMBER_OF_REPLICAS, 0)
343343
.build();
344-
String mappings = "\"_doc\":{\"properties\":{\"field-1\":{\"type\":\"integer\"}}}";
344+
String mappings = "\"properties\":{\"field-1\":{\"type\":\"integer\"}}";
345345
createIndex(indexName, basicSettings, mappings);
346346

347347
GetIndexRequest getIndexRequest = new GetIndexRequest()
@@ -371,7 +371,7 @@ public void testGetIndexWithDefaults() throws IOException {
371371
.put(SETTING_NUMBER_OF_SHARDS, 1)
372372
.put(SETTING_NUMBER_OF_REPLICAS, 0)
373373
.build();
374-
String mappings = "\"_doc\":{\"properties\":{\"field-1\":{\"type\":\"integer\"}}}";
374+
String mappings = "\"properties\":{\"field-1\":{\"type\":\"integer\"}}";
375375
createIndex(indexName, basicSettings, mappings);
376376

377377
GetIndexRequest getIndexRequest = new GetIndexRequest()
@@ -1251,8 +1251,8 @@ public void testPutTemplate() throws Exception {
12511251
assertThat(extractRawValues("my-template.index_patterns", templates), contains("pattern-1", "name-*"));
12521252
assertThat(extractValue("my-template.settings.index.number_of_shards", templates), equalTo("3"));
12531253
assertThat(extractValue("my-template.settings.index.number_of_replicas", templates), equalTo("0"));
1254-
assertThat(extractValue("my-template.mappings.doc.properties.host_name.type", templates), equalTo("keyword"));
1255-
assertThat(extractValue("my-template.mappings.doc.properties.description.type", templates), equalTo("text"));
1254+
assertThat(extractValue("my-template.mappings.properties.host_name.type", templates), equalTo("keyword"));
1255+
assertThat(extractValue("my-template.mappings.properties.description.type", templates), equalTo("text"));
12561256
assertThat((Map<String, String>) extractValue("my-template.aliases.alias-1", templates), hasEntry("index_routing", "abc"));
12571257
assertThat((Map<String, String>) extractValue("my-template.aliases.{index}-write", templates), hasEntry("search_routing", "xyz"));
12581258
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
import static org.elasticsearch.index.RandomCreateIndexGenerator.randomCreateIndexRequest;
7979
import static org.elasticsearch.index.RandomCreateIndexGenerator.randomIndexSettings;
8080
import static org.elasticsearch.index.alias.RandomAliasActionsGenerator.randomAliasAction;
81+
import static org.elasticsearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER;
8182
import static org.hamcrest.CoreMatchers.equalTo;
8283
import static org.hamcrest.Matchers.nullValue;
8384

@@ -132,6 +133,7 @@ public void testCreateIndex() throws IOException {
132133
RequestConvertersTests.setRandomTimeout(createIndexRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
133134
RequestConvertersTests.setRandomMasterTimeout(createIndexRequest, expectedParams);
134135
RequestConvertersTests.setRandomWaitForActiveShards(createIndexRequest::waitForActiveShards, expectedParams);
136+
expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true");
135137

136138
Request request = IndicesRequestConverters.createIndex(createIndexRequest);
137139
Assert.assertEquals("/" + createIndexRequest.index(), request.getEndpoint());
@@ -173,6 +175,7 @@ public void testPutMapping() throws IOException {
173175

174176
RequestConvertersTests.setRandomTimeout(putMappingRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
175177
RequestConvertersTests.setRandomMasterTimeout(putMappingRequest, expectedParams);
178+
expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true");
176179

177180
Request request = IndicesRequestConverters.putMapping(putMappingRequest);
178181
StringJoiner endpoint = new StringJoiner("/", "/", "");
@@ -214,6 +217,7 @@ public void testGetMapping() throws IOException {
214217
getMappingRequest::indicesOptions, expectedParams);
215218
RequestConvertersTests.setRandomMasterTimeout(getMappingRequest, expectedParams);
216219
RequestConvertersTests.setRandomLocal(getMappingRequest, expectedParams);
220+
expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true");
217221

218222
Request request = IndicesRequestConverters.getMappings(getMappingRequest);
219223
StringJoiner endpoint = new StringJoiner("/", "/", "");
@@ -266,6 +270,7 @@ public void testGetFieldMapping() throws IOException {
266270
RequestConvertersTests.setRandomIndicesOptions(getFieldMappingsRequest::indicesOptions, getFieldMappingsRequest::indicesOptions,
267271
expectedParams);
268272
RequestConvertersTests.setRandomLocal(getFieldMappingsRequest::local, expectedParams);
273+
expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true");
269274

270275
Request request = IndicesRequestConverters.getFieldMapping(getFieldMappingsRequest);
271276
StringJoiner endpoint = new StringJoiner("/", "/", "");
@@ -835,6 +840,8 @@ public void testPutTemplateRequest() throws Exception {
835840
expectedParams.put("cause", cause);
836841
}
837842
RequestConvertersTests.setRandomMasterTimeout(putTemplateRequest, expectedParams);
843+
expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true");
844+
838845
Request request = IndicesRequestConverters.putTemplate(putTemplateRequest);
839846
Assert.assertThat(request.getEndpoint(), equalTo("/_template/" + names.get(putTemplateRequest.name())));
840847
Assert.assertThat(request.getParameters(), equalTo(expectedParams));
@@ -888,6 +895,8 @@ public void testGetTemplateRequest() throws Exception {
888895
Map<String, String> expectedParams = new HashMap<>();
889896
RequestConvertersTests.setRandomMasterTimeout(getTemplatesRequest::setMasterNodeTimeout, expectedParams);
890897
RequestConvertersTests.setRandomLocal(getTemplatesRequest::setLocal, expectedParams);
898+
expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true");
899+
891900
Request request = IndicesRequestConverters.getTemplates(getTemplatesRequest);
892901
Assert.assertThat(request.getEndpoint(),
893902
equalTo("/_template/" + names.stream().map(encodes::get).collect(Collectors.joining(","))));

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

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,9 @@ public void indexDocuments() throws IOException {
140140
create.setJsonEntity(
141141
"{" +
142142
" \"mappings\": {" +
143-
" \"_doc\": {" +
144-
" \"properties\": {" +
145-
" \"rating\": {" +
146-
" \"type\": \"keyword\"" +
147-
" }" +
143+
" \"properties\": {" +
144+
" \"rating\": {" +
145+
" \"type\": \"keyword\"" +
148146
" }" +
149147
" }" +
150148
" }" +
@@ -172,16 +170,14 @@ public void indexDocuments() throws IOException {
172170
create.setJsonEntity(
173171
"{" +
174172
" \"mappings\": {" +
175-
" \"_doc\": {" +
176-
" \"properties\": {" +
177-
" \"field1\": {" +
178-
" \"type\": \"keyword\"," +
179-
" \"store\": true" +
180-
" }," +
181-
" \"field2\": {" +
182-
" \"type\": \"keyword\"," +
183-
" \"store\": true" +
184-
" }" +
173+
" \"properties\": {" +
174+
" \"field1\": {" +
175+
" \"type\": \"keyword\"," +
176+
" \"store\": true" +
177+
" }," +
178+
" \"field2\": {" +
179+
" \"type\": \"keyword\"," +
180+
" \"store\": true" +
185181
" }" +
186182
" }" +
187183
" }" +
@@ -445,12 +441,10 @@ public void testSearchWithParentJoin() throws IOException {
445441
createIndex.setJsonEntity(
446442
"{\n" +
447443
" \"mappings\": {\n" +
448-
" \"_doc\" : {\n" +
449-
" \"properties\" : {\n" +
450-
" \"qa_join_field\" : {\n" +
451-
" \"type\" : \"join\",\n" +
452-
" \"relations\" : { \"question\" : \"answer\" }\n" +
453-
" }\n" +
444+
" \"properties\" : {\n" +
445+
" \"qa_join_field\" : {\n" +
446+
" \"type\" : \"join\",\n" +
447+
" \"relations\" : { \"question\" : \"answer\" }\n" +
454448
" }\n" +
455449
" }\n" +
456450
" }" +

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -792,17 +792,15 @@ public void testReindex() throws Exception {
792792
RestHighLevelClient client = highLevelClient();
793793
{
794794
String mapping =
795-
"\"_doc\": {\n" +
796-
" \"properties\": {\n" +
797-
" \"user\": {\n" +
798-
" \"type\": \"text\"\n" +
799-
" },\n" +
800-
" \"field1\": {\n" +
801-
" \"type\": \"integer\"\n" +
802-
" },\n" +
803-
" \"field2\": {\n" +
804-
" \"type\": \"integer\"\n" +
805-
" }\n" +
795+
" \"properties\": {\n" +
796+
" \"user\": {\n" +
797+
" \"type\": \"text\"\n" +
798+
" },\n" +
799+
" \"field1\": {\n" +
800+
" \"type\": \"integer\"\n" +
801+
" },\n" +
802+
" \"field2\": {\n" +
803+
" \"type\": \"integer\"\n" +
806804
" }\n" +
807805
" }";
808806
createIndex("source1", Settings.EMPTY, mapping);
@@ -1000,19 +998,17 @@ public void testUpdateByQuery() throws Exception {
1000998
RestHighLevelClient client = highLevelClient();
1001999
{
10021000
String mapping =
1003-
"\"_doc\": {\n" +
1004-
" \"properties\": {\n" +
1005-
" \"user\": {\n" +
1006-
" \"type\": \"text\"\n" +
1007-
" },\n" +
1008-
" \"field1\": {\n" +
1009-
" \"type\": \"integer\"\n" +
1010-
" },\n" +
1011-
" \"field2\": {\n" +
1012-
" \"type\": \"integer\"\n" +
1013-
" }\n" +
1014-
" }\n" +
1015-
" }";
1001+
" \"properties\": {\n" +
1002+
" \"user\": {\n" +
1003+
" \"type\": \"text\"\n" +
1004+
" },\n" +
1005+
" \"field1\": {\n" +
1006+
" \"type\": \"integer\"\n" +
1007+
" },\n" +
1008+
" \"field2\": {\n" +
1009+
" \"type\": \"integer\"\n" +
1010+
" }\n" +
1011+
" }";
10161012
createIndex("source1", Settings.EMPTY, mapping);
10171013
createIndex("source2", Settings.EMPTY, mapping);
10181014
createPipeline("my_pipeline");
@@ -1125,19 +1121,17 @@ public void testDeleteByQuery() throws Exception {
11251121
RestHighLevelClient client = highLevelClient();
11261122
{
11271123
String mapping =
1128-
"\"_doc\": {\n" +
1129-
" \"properties\": {\n" +
1130-
" \"user\": {\n" +
1131-
" \"type\": \"text\"\n" +
1132-
" },\n" +
1133-
" \"field1\": {\n" +
1134-
" \"type\": \"integer\"\n" +
1135-
" },\n" +
1136-
" \"field2\": {\n" +
1137-
" \"type\": \"integer\"\n" +
1138-
" }\n" +
1139-
" }\n" +
1140-
" }";
1124+
" \"properties\": {\n" +
1125+
" \"user\": {\n" +
1126+
" \"type\": \"text\"\n" +
1127+
" },\n" +
1128+
" \"field1\": {\n" +
1129+
" \"type\": \"integer\"\n" +
1130+
" },\n" +
1131+
" \"field2\": {\n" +
1132+
" \"type\": \"integer\"\n" +
1133+
" }\n" +
1134+
" }";
11411135
createIndex("source1", Settings.EMPTY, mapping);
11421136
createIndex("source2", Settings.EMPTY, mapping);
11431137
}

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SearchDocumentationIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,12 +715,12 @@ public void onFailure(Exception e) {
715715
SearchHit[] searchHits = searchResponse.getHits().getHits();
716716

717717
while (searchHits != null && searchHits.length > 0) { // <2>
718-
SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId); // <3>
718+
// <3>
719+
SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId); // <4>
719720
scrollRequest.scroll(scroll);
720721
searchResponse = client.scroll(scrollRequest, RequestOptions.DEFAULT);
721722
scrollId = searchResponse.getScrollId();
722723
searchHits = searchResponse.getHits().getHits();
723-
// <4>
724724
}
725725

726726
ClearScrollRequest clearScrollRequest = new ClearScrollRequest(); // <5>

0 commit comments

Comments
 (0)