Skip to content

Commit eef3abf

Browse files
committed
Merge branch '6.x' into ccr-6.x
* 6.x: Security: revert to old way of merging automata (#32254) Fix a test bug in RangeQueryBuilderTests introduced in the field aliases backport. Introduce Application Privileges with support for Kibana RBAC (#32309) Undo a debugging change that snuck in during the field aliases merge. [test] port linux package packaging tests (#31943) Painless: Update More Methods to New Naming Scheme (#32305) Tribe: Add error with secure settings copied to tribe (#32298) Add V_6_3_3 version constant Add ERR to ranking evaluation documentation (#32314) [DOCS] Added link to 6.3.2 RNs [DOCS] Updates 6.3.2 release notes with PRs from ml-cpp repo (#32334) [Kerberos] Add Kerberos authentication support (#32263) [ML] Extract persistent task methods from MlMetadata (#32319) Backport - Add Snapshots Status API to High Level Rest Client (#32295) Make release notes ignore the `>test-failure` label. (#31309) [DOCS] Adds release highlights for search for 6.4 (#32095) Allow Integ Tests to run in a FIPS-140 JVM (#32316) Add support for field aliases to 6.x. (#32184) Register ERR metric with NamedXContentRegistry (#32320) fixes broken build for third-party-tests (#32315) Relates #31918 / Closes infra/issues/6085 [DOCS] Rollup Caps API incorrectly mentions GET Jobs API (#32280) Rest HL client: Add put watch action (#32026) (#32191) Add WeightedAvg metric aggregation (#31037) Consistent encoder names (#29492) Switch monitoring to new style Requests (#32255) specify subdirs of lib, bin, modules in package (#32253) Rename ranking evaluation `quality_level` to `metric_score` (#32168) Add new permission for JDK11 to load JAAS libraries (#32132) Switch x-pack:core to new style Requests (#32252) Watcher: Store username on watch execution (#31873) Silence SSL reload test that fails on JDK 11 Painless: Clean up add methods in PainlessLookup (#32258) CCE when re-throwing "shard not available" exception in TransportShardMultiGetAction (#32185) Fail shard if IndexShard#storeStats runs into an IOException (#32241) Fix `range` queries on `_type` field for singe type indices (#31756) (#32161) AwaitsFix RecoveryIT#testHistoryUUIDIsGenerated Add new fields to monitoring template for Beats state (#32085) (#32273) [TEST] improve REST high-level client naming conventions check (#32244) Check that client methods match API defined in the REST spec (#31825)
2 parents 7c947d0 + 1e6fa9a commit eef3abf

File tree

523 files changed

+22643
-4227
lines changed

Some content is hidden

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

523 files changed

+22643
-4227
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy

+10-1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ class BuildPlugin implements Plugin<Project> {
131131
runtimeJavaVersionEnum = JavaVersion.toVersion(findJavaSpecificationVersion(project, runtimeJavaHome))
132132
}
133133

134+
String inFipsJvmScript = 'print(java.security.Security.getProviders()[0].name.toLowerCase().contains("fips"));'
135+
boolean inFipsJvm = Boolean.parseBoolean(runJavascript(project, runtimeJavaHome, inFipsJvmScript))
136+
134137
// Build debugging info
135138
println '======================================='
136139
println 'Elasticsearch Build Hamster says Hello!'
@@ -202,6 +205,7 @@ class BuildPlugin implements Plugin<Project> {
202205
project.rootProject.ext.buildChecksDone = true
203206
project.rootProject.ext.minimumCompilerVersion = minimumCompilerVersion
204207
project.rootProject.ext.minimumRuntimeVersion = minimumRuntimeVersion
208+
project.rootProject.ext.inFipsJvm = inFipsJvm
205209
}
206210

207211
project.targetCompatibility = project.rootProject.ext.minimumRuntimeVersion
@@ -213,6 +217,7 @@ class BuildPlugin implements Plugin<Project> {
213217
project.ext.compilerJavaVersion = project.rootProject.ext.compilerJavaVersion
214218
project.ext.runtimeJavaVersion = project.rootProject.ext.runtimeJavaVersion
215219
project.ext.javaVersions = project.rootProject.ext.javaVersions
220+
project.ext.inFipsJvm = project.rootProject.ext.inFipsJvm
216221
}
217222

218223
private static String findCompilerJavaHome() {
@@ -771,7 +776,11 @@ class BuildPlugin implements Plugin<Project> {
771776
systemProperty property.getKey(), property.getValue()
772777
}
773778
}
774-
779+
// Set the system keystore/truststore password if we're running tests in a FIPS-140 JVM
780+
if (project.inFipsJvm) {
781+
systemProperty 'javax.net.ssl.trustStorePassword', 'password'
782+
systemProperty 'javax.net.ssl.keyStorePassword', 'password'
783+
}
775784
boolean assertionsEnabled = Boolean.parseBoolean(System.getProperty('tests.asserts', 'true'))
776785
enableSystemAssertions assertionsEnabled
777786
enableAssertions assertionsEnabled

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import org.elasticsearch.gradle.VersionProperties
2424
import org.gradle.api.DefaultTask
2525
import org.gradle.api.Project
2626
import org.gradle.api.Task
27-
import org.gradle.api.Transformer
2827
import org.gradle.api.execution.TaskExecutionAdapter
2928
import org.gradle.api.internal.tasks.options.Option
3029
import org.gradle.api.provider.Property
@@ -217,7 +216,7 @@ public class RestIntegTestTask extends DefaultTask {
217216
* @param project The project to add the copy task to
218217
* @param includePackagedTests true if the packaged tests should be copied, false otherwise
219218
*/
220-
private static Task createCopyRestSpecTask(Project project, Provider<Boolean> includePackagedTests) {
219+
static Task createCopyRestSpecTask(Project project, Provider<Boolean> includePackagedTests) {
221220
project.configurations {
222221
restSpec
223222
}

client/rest-high-level/build.gradle

+6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ dependencies {
5252
testCompile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
5353
testCompile "junit:junit:${versions.junit}"
5454
testCompile "org.hamcrest:hamcrest-all:${versions.hamcrest}"
55+
//this is needed to make RestHighLevelClientTests#testApiNamingConventions work from IDEs
56+
testCompile "org.elasticsearch:rest-api-spec:${version}"
5557
}
5658

5759
dependencyLicenses {
@@ -68,3 +70,7 @@ forbiddenApisMain {
6870
signaturesURLs += [PrecommitTasks.getResource('/forbidden/http-signatures.txt')]
6971
signaturesURLs += [file('src/main/resources/forbidden/rest-high-level-signatures.txt').toURI().toURL()]
7072
}
73+
74+
integTestCluster {
75+
setting 'xpack.license.self_generated.type', 'trial'
76+
}

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

+32-3
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public void putMappingAsync(PutMappingRequest putMappingRequest, ActionListener<
254254
* @return the response
255255
* @throws IOException in case there is a problem sending the request or parsing back the response
256256
*/
257-
public GetMappingsResponse getMappings(GetMappingsRequest getMappingsRequest, RequestOptions options) throws IOException {
257+
public GetMappingsResponse getMapping(GetMappingsRequest getMappingsRequest, RequestOptions options) throws IOException {
258258
return restHighLevelClient.performRequestAndParseEntity(getMappingsRequest, RequestConverters::getMappings, options,
259259
GetMappingsResponse::fromXContent, emptySet());
260260
}
@@ -267,8 +267,8 @@ public GetMappingsResponse getMappings(GetMappingsRequest getMappingsRequest, Re
267267
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
268268
* @param listener the listener to be notified upon request completion
269269
*/
270-
public void getMappingsAsync(GetMappingsRequest getMappingsRequest, RequestOptions options,
271-
ActionListener<GetMappingsResponse> listener) {
270+
public void getMappingAsync(GetMappingsRequest getMappingsRequest, RequestOptions options,
271+
ActionListener<GetMappingsResponse> listener) {
272272
restHighLevelClient.performRequestAsyncAndParseEntity(getMappingsRequest, RequestConverters::getMappings, options,
273273
GetMappingsResponse::fromXContent, listener, emptySet());
274274
}
@@ -709,8 +709,23 @@ public void getAsync(GetIndexRequest getIndexRequest, RequestOptions options,
709709
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
710710
* @return the response
711711
* @throws IOException in case there is a problem sending the request or parsing back the response
712+
* @deprecated use {@link #forcemerge(ForceMergeRequest, RequestOptions)} instead
712713
*/
714+
@Deprecated
713715
public ForceMergeResponse forceMerge(ForceMergeRequest forceMergeRequest, RequestOptions options) throws IOException {
716+
return forcemerge(forceMergeRequest, options);
717+
}
718+
719+
/**
720+
* Force merge one or more indices using the Force Merge API.
721+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-forcemerge.html">
722+
* Force Merge API on elastic.co</a>
723+
* @param forceMergeRequest the request
724+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
725+
* @return the response
726+
* @throws IOException in case there is a problem sending the request or parsing back the response
727+
*/
728+
public ForceMergeResponse forcemerge(ForceMergeRequest forceMergeRequest, RequestOptions options) throws IOException {
714729
return restHighLevelClient.performRequestAndParseEntity(forceMergeRequest, RequestConverters::forceMerge, options,
715730
ForceMergeResponse::fromXContent, emptySet());
716731
}
@@ -735,8 +750,22 @@ public ForceMergeResponse forceMerge(ForceMergeRequest forceMergeRequest, Header
735750
* @param forceMergeRequest the request
736751
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
737752
* @param listener the listener to be notified upon request completion
753+
* @deprecated use {@link #forcemergeAsync(ForceMergeRequest, RequestOptions, ActionListener)} instead
738754
*/
755+
@Deprecated
739756
public void forceMergeAsync(ForceMergeRequest forceMergeRequest, RequestOptions options, ActionListener<ForceMergeResponse> listener) {
757+
forcemergeAsync(forceMergeRequest, options, listener);
758+
}
759+
760+
/**
761+
* Asynchronously force merge one or more indices using the Force Merge API.
762+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-forcemerge.html">
763+
* Force Merge API on elastic.co</a>
764+
* @param forceMergeRequest the request
765+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
766+
* @param listener the listener to be notified upon request completion
767+
*/
768+
public void forcemergeAsync(ForceMergeRequest forceMergeRequest, RequestOptions options, ActionListener<ForceMergeResponse> listener) {
740769
restHighLevelClient.performRequestAsyncAndParseEntity(forceMergeRequest, RequestConverters::forceMerge, options,
741770
ForceMergeResponse::fromXContent, listener, emptySet());
742771
}

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public void deletePipelineAsync(DeletePipelineRequest request, RequestOptions op
139139
* @return the response
140140
* @throws IOException in case there is a problem sending the request or parsing back the response
141141
*/
142-
public SimulatePipelineResponse simulatePipeline(SimulatePipelineRequest request, RequestOptions options) throws IOException {
142+
public SimulatePipelineResponse simulate(SimulatePipelineRequest request, RequestOptions options) throws IOException {
143143
return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::simulatePipeline, options,
144144
SimulatePipelineResponse::fromXContent, emptySet());
145145
}
@@ -154,9 +154,9 @@ public SimulatePipelineResponse simulatePipeline(SimulatePipelineRequest request
154154
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
155155
* @param listener the listener to be notified upon request completion
156156
*/
157-
public void simulatePipelineAsync(SimulatePipelineRequest request,
158-
RequestOptions options,
159-
ActionListener<SimulatePipelineResponse> listener) {
157+
public void simulateAsync(SimulatePipelineRequest request,
158+
RequestOptions options,
159+
ActionListener<SimulatePipelineResponse> listener) {
160160
restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::simulatePipeline, options,
161161
SimulatePipelineResponse::fromXContent, listener, emptySet());
162162
}

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

+42-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest;
4444
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest;
4545
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest;
46+
import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest;
4647
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
4748
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
4849
import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest;
@@ -105,6 +106,7 @@
105106
import org.elasticsearch.index.VersionType;
106107
import org.elasticsearch.index.rankeval.RankEvalRequest;
107108
import org.elasticsearch.protocol.xpack.XPackInfoRequest;
109+
import org.elasticsearch.protocol.xpack.watcher.PutWatchRequest;
108110
import org.elasticsearch.protocol.xpack.XPackUsageRequest;
109111
import org.elasticsearch.rest.action.search.RestSearchAction;
110112
import org.elasticsearch.script.mustache.MultiSearchTemplateRequest;
@@ -975,6 +977,20 @@ static Request getSnapshots(GetSnapshotsRequest getSnapshotsRequest) {
975977
return request;
976978
}
977979

980+
static Request snapshotsStatus(SnapshotsStatusRequest snapshotsStatusRequest) {
981+
String endpoint = new EndpointBuilder().addPathPartAsIs("_snapshot")
982+
.addPathPart(snapshotsStatusRequest.repository())
983+
.addCommaSeparatedPathParts(snapshotsStatusRequest.snapshots())
984+
.addPathPartAsIs("_status")
985+
.build();
986+
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
987+
988+
Params parameters = new Params(request);
989+
parameters.withMasterTimeout(snapshotsStatusRequest.masterNodeTimeout());
990+
parameters.withIgnoreUnavailable(snapshotsStatusRequest.ignoreUnavailable());
991+
return request;
992+
}
993+
978994
static Request deleteSnapshot(DeleteSnapshotRequest deleteSnapshotRequest) {
979995
String endpoint = new EndpointBuilder().addPathPartAsIs("_snapshot")
980996
.addPathPart(deleteSnapshotRequest.repository())
@@ -1093,6 +1109,25 @@ static Request xPackInfo(XPackInfoRequest infoRequest) {
10931109
return request;
10941110
}
10951111

1112+
static Request xPackWatcherPutWatch(PutWatchRequest putWatchRequest) {
1113+
String endpoint = new EndpointBuilder()
1114+
.addPathPartAsIs("_xpack")
1115+
.addPathPartAsIs("watcher")
1116+
.addPathPartAsIs("watch")
1117+
.addPathPart(putWatchRequest.getId())
1118+
.build();
1119+
1120+
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
1121+
Params params = new Params(request).withVersion(putWatchRequest.getVersion());
1122+
if (putWatchRequest.isActive() == false) {
1123+
params.putParam("active", "false");
1124+
}
1125+
ContentType contentType = createContentType(putWatchRequest.xContentType());
1126+
BytesReference source = putWatchRequest.getSource();
1127+
request.setEntity(new ByteArrayEntity(source.toBytesRef().bytes, 0, source.length(), contentType));
1128+
return request;
1129+
}
1130+
10961131
static Request xpackUsage(XPackUsageRequest usageRequest) {
10971132
Request request = new Request(HttpGet.METHOD_NAME, "/_xpack/usage");
10981133
Params parameters = new Params(request);
@@ -1288,7 +1323,7 @@ Params withWaitForActiveShards(ActiveShardCount currentActiveShardCount, ActiveS
12881323
}
12891324

12901325
Params withIndicesOptions(IndicesOptions indicesOptions) {
1291-
putParam("ignore_unavailable", Boolean.toString(indicesOptions.ignoreUnavailable()));
1326+
withIgnoreUnavailable(indicesOptions.ignoreUnavailable());
12921327
putParam("allow_no_indices", Boolean.toString(indicesOptions.allowNoIndices()));
12931328
String expandWildcards;
12941329
if (indicesOptions.expandWildcardsOpen() == false && indicesOptions.expandWildcardsClosed() == false) {
@@ -1307,6 +1342,12 @@ Params withIndicesOptions(IndicesOptions indicesOptions) {
13071342
return this;
13081343
}
13091344

1345+
Params withIgnoreUnavailable(boolean ignoreUnavailable) {
1346+
// Always explicitly place the ignore_unavailable value.
1347+
putParam("ignore_unavailable", Boolean.toString(ignoreUnavailable));
1348+
return this;
1349+
}
1350+
13101351
Params withHuman(boolean human) {
13111352
if (human) {
13121353
putParam("human", Boolean.toString(human));

0 commit comments

Comments
 (0)