Skip to content

Commit 0888442

Browse files
Merge branch 'master' into repository-encrypted-client-side
2 parents acce93c + 3ba5e02 commit 0888442

File tree

251 files changed

+7822
-2107
lines changed

Some content is hidden

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

251 files changed

+7822
-2107
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ apply from: 'gradle/build-scan.gradle'
4545
apply from: 'gradle/build-complete.gradle'
4646
apply from: 'gradle/runtime-jdk-provision.gradle'
4747
apply from: 'gradle/ide.gradle'
48+
apply from: 'gradle/forbidden-dependencies.gradle'
4849
apply from: 'gradle/formatting.gradle'
4950

5051
// common maven publishing configuration

buildSrc/formatterConfig.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
4848
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="true"/>
4949
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
50-
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="80"/>
50+
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
5151
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
5252
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
5353
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
@@ -132,7 +132,7 @@
132132
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="48"/>
133133
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
134134
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="48"/>
135-
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="64"/>
135+
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
136136
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
137137
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
138138
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ class BuildPlugin implements Plugin<Project> {
284284
project.configurations.getByName(JavaPlugin.COMPILE_CONFIGURATION_NAME).dependencies.all(disableTransitiveDeps)
285285
project.configurations.getByName(JavaPlugin.TEST_COMPILE_CONFIGURATION_NAME).dependencies.all(disableTransitiveDeps)
286286
project.configurations.getByName(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME).dependencies.all(disableTransitiveDeps)
287+
project.configurations.getByName(JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME).dependencies.all(disableTransitiveDeps)
287288
}
288289

289290
/** Adds repositories used by ES dependencies */

buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ class PluginBuildPlugin implements Plugin<Project> {
131131
}
132132
createIntegTestTask(project)
133133
createBundleTasks(project, extension)
134-
project.configurations.getByName('default').extendsFrom(project.configurations.getByName('runtime'))
134+
project.configurations.getByName('default')
135+
.extendsFrom(project.configurations.getByName('runtimeClasspath'))
135136
// allow running ES with this plugin in the foreground of a build
136137
project.tasks.register('run', RunTask) {
137138
dependsOn(project.tasks.bundlePlugin)
@@ -210,7 +211,7 @@ class PluginBuildPlugin implements Plugin<Project> {
210211
* that shadow jar.
211212
*/
212213
from { project.plugins.hasPlugin(ShadowPlugin) ? project.shadowJar : project.jar }
213-
from project.configurations.runtime - project.configurations.compileOnly
214+
from project.configurations.runtimeClasspath - project.configurations.compileOnly
214215
// extra files for the plugin to go into the zip
215216
from('src/main/packaging') // TODO: move all config/bin/_size/etc into packaging
216217
from('src/main') {

buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import org.elasticsearch.gradle.util.Util
2828
import org.gradle.api.JavaVersion
2929
import org.gradle.api.Project
3030
import org.gradle.api.artifacts.Configuration
31+
import org.gradle.api.file.FileCollection
3132
import org.gradle.api.plugins.JavaBasePlugin
3233
import org.gradle.api.plugins.quality.Checkstyle
3334
import org.gradle.api.tasks.TaskProvider
@@ -142,6 +143,19 @@ class PrecommitTasks {
142143
ExportElasticsearchBuildResourcesTask buildResources = project.tasks.getByName('buildResources')
143144
project.tasks.withType(CheckForbiddenApis).configureEach {
144145
dependsOn(buildResources)
146+
147+
// use the runtime classpath if we have it, but some qa projects don't have one...
148+
if (name.endsWith('Test')) {
149+
FileCollection runtime = project.sourceSets.test.runtimeClasspath
150+
if (runtime != null) {
151+
classpath = runtime.plus(project.sourceSets.test.compileClasspath)
152+
}
153+
} else {
154+
FileCollection runtime = project.sourceSets.main.runtimeClasspath
155+
if (runtime != null) {
156+
classpath = runtime.plus(project.sourceSets.main.compileClasspath)
157+
}
158+
}
145159
targetCompatibility = BuildParams.runtimeJavaVersion.majorVersion
146160
if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_13) {
147161
project.logger.warn(

buildSrc/src/main/java/org/elasticsearch/gradle/precommit/DependencyLicensesTask.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,7 @@ private void failIfAnyMissing(String item, Boolean exists, String type) {
210210
}
211211

212212
private void checkDependencies(Map<String, Boolean> licenses, Map<String, Boolean> notices, Set<File> shaFiles)
213-
throws NoSuchAlgorithmException,
214-
IOException {
213+
throws NoSuchAlgorithmException, IOException {
215214
for (File dependency : dependencies) {
216215
String jarName = dependency.getName();
217216
String depName = regex.matcher(jarName).replaceFirst("");

buildSrc/src/main/java/org/elasticsearch/gradle/precommit/ThirdPartyAuditTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ private Set<String> runJdkJarHellCheck() throws IOException {
388388
}
389389

390390
private Configuration getRuntimeConfiguration() {
391-
Configuration runtime = getProject().getConfigurations().findByName("runtime");
391+
Configuration runtime = getProject().getConfigurations().findByName("runtimeClasspath");
392392
if (runtime == null) {
393393
return getProject().getConfigurations().getByName("testCompile");
394394
}

distribution/bwc/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ bwcVersions.forPreviousUnreleased { BwcVersions.UnreleasedVersionInfo unreleased
194194
if (gradle.startParameter.isOffline()) {
195195
args "--offline"
196196
}
197+
String buildCacheUrl = System.getProperty('org.elasticsearch.build.cache.url')
198+
if (buildCacheUrl) {
199+
args "-Dorg.elasticsearch.build.cache.url=${buildCacheUrl}"
200+
}
197201

198202
args "-Dbuild.snapshot=true"
199203
args "-Dscan.tag.NESTED"

distribution/tools/keystore-cli/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ dependencies {
2424
compileOnly project(":libs:elasticsearch-cli")
2525
testCompile project(":test:framework")
2626
testCompile 'com.google.jimfs:jimfs:1.1'
27-
testCompile 'com.google.guava:guava:18.0'
27+
testRuntimeOnly 'com.google.guava:guava:18.0'
2828
}

distribution/tools/launchers/src/main/java/org/elasticsearch/tools/launchers/JvmOptionsParser.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ public static void main(final String[] args) throws InterruptedException, IOExce
124124
}
125125

126126
private List<String> jvmOptions(final Path config, final String esJavaOpts, final Map<String, String> substitutions)
127-
throws InterruptedException,
128-
IOException,
129-
JvmOptionsFileParserException {
127+
throws InterruptedException, IOException, JvmOptionsFileParserException {
130128

131129
final List<String> jvmOptions = readJvmOptionsFiles(config);
132130

distribution/tools/plugin-cli/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import org.elasticsearch.gradle.info.BuildParams
2-
31
/*
42
* Licensed to Elasticsearch under one or more contributor
53
* license agreements. See the NOTICE file distributed with
@@ -30,7 +28,7 @@ dependencies {
3028
compile "org.bouncycastle:bc-fips:1.0.1"
3129
testCompile project(":test:framework")
3230
testCompile 'com.google.jimfs:jimfs:1.1'
33-
testCompile 'com.google.guava:guava:18.0'
31+
testRuntimeOnly 'com.google.guava:guava:18.0'
3432
}
3533

3634
dependencyLicenses {

distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,7 @@ private String getElasticUrl(
330330
final boolean isSnapshot,
331331
final String pluginId,
332332
final String platform
333-
) throws IOException,
334-
UserException {
333+
) throws IOException, UserException {
335334
final String baseUrl;
336335
if (isSnapshot && stagingHash == null) {
337336
throw new UserException(
@@ -506,9 +505,7 @@ private Path downloadAndValidate(
506505
final Path tmpDir,
507506
final boolean officialPlugin,
508507
boolean isBatch
509-
) throws IOException,
510-
PGPException,
511-
UserException {
508+
) throws IOException, PGPException, UserException {
512509
Path zip = downloadZip(terminal, urlString, tmpDir, isBatch);
513510
pathsToDeleteOnShutdown.add(zip);
514511
String checksumUrlString = urlString + ".sha512";

docs/build.gradle

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,41 @@ for (int i = 0; i < 100; i++) {
539539
{"load_time": "$value"}"""
540540
}
541541

542+
// Used by t_test aggregations
543+
buildRestTests.setups['node_upgrade'] = '''
544+
- do:
545+
indices.create:
546+
index: node_upgrade
547+
body:
548+
settings:
549+
number_of_shards: 1
550+
number_of_replicas: 1
551+
mappings:
552+
properties:
553+
name:
554+
type: keyword
555+
startup_time_before:
556+
type: long
557+
startup_time_after:
558+
type: long
559+
- do:
560+
bulk:
561+
index: node_upgrade
562+
refresh: true
563+
body: |
564+
{"index":{}}
565+
{"name": "A", "startup_time_before": 102, "startup_time_after": 89}
566+
{"index":{}}
567+
{"name": "B", "startup_time_before": 99, "startup_time_after": 93}
568+
{"index":{}}
569+
{"name": "C", "startup_time_before": 111, "startup_time_after": 72}
570+
{"index":{}}
571+
{"name": "D", "startup_time_before": 97, "startup_time_after": 98}
572+
{"index":{}}
573+
{"name": "E", "startup_time_before": 101, "startup_time_after": 102}
574+
{"index":{}}
575+
{"name": "F", "startup_time_before": 99, "startup_time_after": 98}'''
576+
542577
// Used by iprange agg
543578
buildRestTests.setups['iprange'] = '''
544579
- do:

docs/reference/aggregations/metrics.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ include::metrics/median-absolute-deviation-aggregation.asciidoc[]
4949

5050
include::metrics/boxplot-aggregation.asciidoc[]
5151

52-
52+
include::metrics/t-test-aggregation.asciidoc[]
5353

5454

5555

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
[role="xpack"]
2+
[testenv="basic"]
3+
[[search-aggregations-metrics-ttest-aggregation]]
4+
=== TTest Aggregation
5+
6+
A `t_test` metrics aggregation that performs a statistical hypothesis test in which the test statistic follows a Student's t-distribution
7+
under the null hypothesis on numeric values extracted from the aggregated documents or generated by provided scripts. In practice, this
8+
will tell you if the difference between two population means are statistically significant and did not occur by chance alone.
9+
10+
==== Syntax
11+
12+
A `t_test` aggregation looks like this in isolation:
13+
14+
[source,js]
15+
--------------------------------------------------
16+
{
17+
"t_test": {
18+
"a": "value_before",
19+
"b": "value_after",
20+
"type": "paired"
21+
}
22+
}
23+
--------------------------------------------------
24+
// NOTCONSOLE
25+
26+
Assuming that we have a record of node start up times before and after upgrade, let's look at a t-test to see if upgrade affected
27+
the node start up time in a meaningful way.
28+
29+
[source,console]
30+
--------------------------------------------------
31+
GET node_upgrade/_search
32+
{
33+
"size": 0,
34+
"aggs" : {
35+
"startup_time_ttest" : {
36+
"t_test" : {
37+
"a" : {"field": "startup_time_before"}, <1>
38+
"b" : {"field": "startup_time_after"}, <2>
39+
"type": "paired" <3>
40+
}
41+
}
42+
}
43+
}
44+
--------------------------------------------------
45+
// TEST[setup:node_upgrade]
46+
<1> The field `startup_time_before` must be a numeric field
47+
<2> The field `startup_time_after` must be a numeric field
48+
<3> Since we have data from the same nodes, we are using paired t-test.
49+
50+
The response will return the p-value or probability value for the test. It is the probability of obtaining results at least as extreme as
51+
the result processed by the aggregation, assuming that the null hypothesis is correct (which means there is no difference between
52+
population means). Smaller p-value means the null hypothesis is more likely to be incorrect and population means are indeed different.
53+
54+
[source,console-result]
55+
--------------------------------------------------
56+
{
57+
...
58+
59+
"aggregations": {
60+
"startup_time_ttest": {
61+
"value": 0.1914368843365979 <1>
62+
}
63+
}
64+
}
65+
--------------------------------------------------
66+
// TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
67+
<1> The p-value.
68+
69+
==== T-Test Types
70+
71+
The `t_test` aggregation supports unpaired and paired two-sample t-tests. The type of the test can be specified using the `type` parameter:
72+
73+
`"type": "paired"`:: performs paired t-test
74+
`"type": "homoscedastic"`:: performs two-sample equal variance test
75+
`"type": "heteroscedastic"`:: performs two-sample unequal variance test (this is default)
76+
77+
==== Script
78+
79+
The `t_test` metric supports scripting. For example, if we need to adjust out load times for the before values, we could use
80+
a script to recalculate them on-the-fly:
81+
82+
[source,console]
83+
--------------------------------------------------
84+
GET node_upgrade/_search
85+
{
86+
"size": 0,
87+
"aggs" : {
88+
"startup_time_ttest" : {
89+
"t_test" : {
90+
"a": {
91+
"script" : {
92+
"lang": "painless",
93+
"source": "doc['startup_time_before'].value - params.adjustment", <1>
94+
"params" : {
95+
"adjustment" : 10 <2>
96+
}
97+
}
98+
},
99+
"b": {
100+
"field": "startup_time_after" <3>
101+
},
102+
"type": "paired"
103+
}
104+
}
105+
}
106+
}
107+
--------------------------------------------------
108+
// TEST[setup:node_upgrade]
109+
110+
<1> The `field` parameter is replaced with a `script` parameter, which uses the
111+
script to generate values which percentiles are calculated on
112+
<2> Scripting supports parameterized input just like any other script
113+
<3> We can mix scripts and fields
114+

docs/reference/analysis/normalizers.asciidoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ following: `arabic_normalization`, `asciifolding`, `bengali_normalization`,
1313
`persian_normalization`, `scandinavian_folding`, `serbian_normalization`,
1414
`sorani_normalization`, `uppercase`.
1515

16+
Elasticsearch ships with a `lowercase` built-in normalizer. For other forms of
17+
normalization a custom configuration is required.
18+
1619
[float]
1720
=== Custom normalizers
1821

19-
Elasticsearch does not ship with built-in normalizers so far, so the only way
20-
to get one is by building a custom one. Custom normalizers take a list of char
22+
Custom normalizers take a list of
2123
<<analysis-charfilters, character filters>> and a list of
2224
<<analysis-tokenfilters,token filters>>.
2325

docs/reference/autoscaling/apis/autoscaling-apis.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ You can use the following APIs to perform autoscaling operations.
1111

1212
* <<autoscaling-get-autoscaling-decision,Get autoscaling decision>>
1313
* <<autoscaling-delete-autoscaling-policy,Delete autoscaling policy>>
14+
* <<autoscaling-get-autoscaling-policy,Get autoscaling policy>>
1415
* <<autoscaling-put-autoscaling-policy,Put autoscaling policy>>
1516

1617
// top-level
1718
include::get-autoscaling-decision.asciidoc[]
1819
include::delete-autoscaling-policy.asciidoc[]
20+
include::get-autoscaling-policy.asciidoc[]
1921
include::put-autoscaling-policy.asciidoc[]

0 commit comments

Comments
 (0)