diff --git a/docs/CHANGELOG.asciidoc b/docs/CHANGELOG.asciidoc index b1cb9c3a4f57a..fde295b56ba72 100644 --- a/docs/CHANGELOG.asciidoc +++ b/docs/CHANGELOG.asciidoc @@ -12,6 +12,8 @@ <> ({pull}29609[#29609]) +<> ({pull}29635[#29635]) + === Breaking Java Changes === Deprecations diff --git a/docs/painless/painless-comments.asciidoc b/docs/painless/painless-comments.asciidoc index d1d2e47a143a6..588e464d97f78 100644 --- a/docs/painless/painless-comments.asciidoc +++ b/docs/painless/painless-comments.asciidoc @@ -1,12 +1,12 @@ [[painless-comments]] === Comments -Painless supports both single-line and multi-line comments. Comments can be -included anywhere within a script. Use the `//` token anywhere on a line to -specify a single-line comment. All characters from the `//` token to the end -of the line are ignored. Use an opening `/*` token and a closing `*/` token -to specify a multi-line comment. Multi-line comments can start anywhere on a -line, and all characters in between the `/*` token and `*/` token are ignored. +Use the `//` token anywhere on a line to specify a single-line comment. All +characters from the `//` token to the end of the line are ignored. Use an +opening `/*` token and a closing `*/` token to specify a multi-line comment. +Multi-line comments can start anywhere on a line, and all characters in between +the `/*` token and `*/` token are ignored. Comments can be included anywhere +within a script. *Grammar* [source,ANTLR4] @@ -17,17 +17,17 @@ MULTI_LINE_COMMENT: '/*' .*? '*/'; *Examples* -Single-line comments. - +* Single-line comments. ++ [source,Painless] ---- // single-line comment int value; // single-line comment ---- - -Multi-line comments. - ++ +* Multi-line comments. ++ [source,Painless] ---- /* multi- diff --git a/docs/painless/painless-identifiers.asciidoc b/docs/painless/painless-identifiers.asciidoc new file mode 100644 index 0000000000000..17073e3d4c415 --- /dev/null +++ b/docs/painless/painless-identifiers.asciidoc @@ -0,0 +1,29 @@ +[[painless-identifiers]] +=== Identifiers + +Specify identifiers to <>, <>, and +<> variables, <>, and +<>. <> and +<> cannot be used as identifiers. + +*Grammar* +[source,ANTLR4] +---- +ID: [_a-zA-Z] [_a-zA-Z-0-9]*; +---- + +*Examples* + +* Variations of identifiers. ++ +[source,Painless] +---- +a +Z +id +list +list0 +MAP25 +_map25 +Map_25 +---- diff --git a/docs/painless/painless-keywords.asciidoc b/docs/painless/painless-keywords.asciidoc index 99b5b4060d24e..cb3bafbd20f13 100644 --- a/docs/painless/painless-keywords.asciidoc +++ b/docs/painless/painless-keywords.asciidoc @@ -2,8 +2,8 @@ === Keywords The keywords in the table below are reserved for built-in language -features. These keywords cannot be used as <> or -<>. +features. These keywords cannot be used as +<> or <>. [cols="^1,^1,^1,^1,^1"] |==== diff --git a/docs/painless/painless-lang-spec.asciidoc b/docs/painless/painless-lang-spec.asciidoc index b324ad301141c..ba6595000ae2f 100644 --- a/docs/painless/painless-lang-spec.asciidoc +++ b/docs/painless/painless-lang-spec.asciidoc @@ -23,6 +23,8 @@ include::painless-keywords.asciidoc[] include::painless-literals.asciidoc[] +include::painless-identifiers.asciidoc[] + include::painless-variables.asciidoc[] include::painless-types.asciidoc[] diff --git a/docs/painless/painless-literals.asciidoc b/docs/painless/painless-literals.asciidoc index 3f91c9299c0ad..441cb264f1e15 100644 --- a/docs/painless/painless-literals.asciidoc +++ b/docs/painless/painless-literals.asciidoc @@ -24,18 +24,18 @@ HEX: '-'? '0' [xX] [0-9a-fA-F]+ [lL]?; *Examples* -Integer literals. - +* Integer literals. ++ [source,Painless] ---- -0 <1> -0D <2> -1234L <3> --90f <4> --022 <5> -0xF2A <6> +<1> 0 +<2> 0D +<3> 1234L +<4> -90f +<5> -022 +<6> 0xF2A ---- - ++ <1> `int 0` <2> `double 0.0` <3> `long 1234` @@ -61,17 +61,17 @@ EXPONENT: ( [eE] [+\-]? [0-9]+ ); *Examples* -Floating point literals. - +* Floating point literals. ++ [source,Painless] ---- -0.0 <1> -1E6 <2> -0.977777 <3> --126.34 <4> -89.9F <5> +<1> 0.0 +<2> 1E6 +<3> 0.977777 +<4> -126.34 +<5> 89.9F ---- - ++ <1> `double 0.0` <2> `double 1000000.0` in exponent notation <3> `double 0.977777` @@ -81,12 +81,11 @@ Floating point literals. [[strings]] ==== Strings -Use string literals to specify string values of the -<> with either single-quotes or double-quotes. -Use a `\"` token to include a double-quote as part of a double-quoted string -literal. Use a `\'` token to include a single-quote as part of a single-quoted -string literal. Use a `\\` token to include a backslash as part of any string -literal. +Use string literals to specify <> values with +either single-quotes or double-quotes. Use a `\"` token to include a +double-quote as part of a double-quoted string literal. Use a `\'` token to +include a single-quote as part of a single-quoted string literal. Use a `\\` +token to include a backslash as part of any string literal. *Grammar* [source,ANTLR4] @@ -97,22 +96,22 @@ STRING: ( '"' ( '\\"' | '\\\\' | ~[\\"] )*? '"' ) *Examples* -String literals using single-quotes. - +* String literals using single-quotes. ++ [source,Painless] ---- 'single-quoted string literal' -'\'single-quoted string with escaped single-quotes\' and backslash \\' -'single-quoted string with non-escaped "double-quotes"' +'\'single-quoted with escaped single-quotes\' and backslash \\' +'single-quoted with non-escaped "double-quotes"' ---- - -String literals using double-quotes. - ++ +* String literals using double-quotes. ++ [source,Painless] ---- "double-quoted string literal" -"\"double-quoted string with escaped double-quotes\" and backslash: \\" -"double-quoted string with non-escaped 'single-quotes'" +"\"double-quoted with escaped double-quotes\" and backslash: \\" +"double-quoted with non-escaped 'single-quotes'" ---- [[characters]] @@ -126,16 +125,16 @@ or an error will occur. *Examples* -Casting string literals into <> values. - +* Casting string literals into <> values. ++ [source,Painless] ---- (char)"C" (char)'c' ---- - -Casting a <> value into a <> value. - ++ +* Casting a <> value into a <> value. ++ [source,Painless] ---- String s = "s"; diff --git a/docs/painless/painless-operators.asciidoc b/docs/painless/painless-operators.asciidoc index 11ee97def66ba..915d811fa441b 100644 --- a/docs/painless/painless-operators.asciidoc +++ b/docs/painless/painless-operators.asciidoc @@ -704,6 +704,7 @@ e = ~d; // sets e the negation of d The cast operator can be used to explicitly convert one type to another. See casting [MARK] for more information. +[[constructor-call]] ==== Constructor Call A constructor call is a special type of method call [MARK] used to allocate a reference type instance using the new operator. The format is the new operator followed by a type, an opening parenthesis, arguments if any, and a closing parenthesis. Arguments are a series of zero-to-many expressions delimited by commas. Auto-boxing and auto-unboxing will be applied automatically for arguments passed into a constructor call. See boxing and unboxing [MARK] for more information on this topic. Constructor argument types can always be resolved at run-time; if appropriate type conversions (casting) cannot be applied an error will occur. Once a reference type instance has been allocated, its members may be used as part of other expressions. diff --git a/docs/painless/painless-variables.asciidoc b/docs/painless/painless-variables.asciidoc index 08725b328a3c2..9756676a08b5b 100644 --- a/docs/painless/painless-variables.asciidoc +++ b/docs/painless/painless-variables.asciidoc @@ -1,122 +1,130 @@ [[painless-variables]] === Variables -Variables in Painless must be declared and can be -statically or <>. - -[[identifiers]] -==== Identifiers - -Specify variable identifiers using the following grammar. Variable identifiers -must start with a letter or underscore. You cannot use -<> or <> as identifiers. - -*Grammar:* -[source,ANTLR4] ----- -ID: [_a-zA-Z] [_a-zA-Z-0-9]*; ----- - -*Examples:* -[source,Java] ----- -a -Z -id -list -list0 -MAP25 -_map25 ----- +<> variables to <> values for +<> in expressions. Specify variables as a +<>, <>, or +<>. Variable operations follow the structure of a +standard JVM in relation to instruction execution and memory usage. [[declaration]] ==== Declaration -Variables must be declared before you use them. The format is `type-name -identifier-name`. To declare multiple variables of the same type, specify a -comma-separated list of identifier names. You can immediately assign a value to -a variable when you declare it. +Declare variables before use with the format of <> +<>. Specify a comma-separated list of +<> following the <> +to declare multiple variables in a single statement. Use an +<> statement combined with a declaration statement to +immediately assign a value to a variable. Variables not immediately assigned a +value will have a default value assigned implicitly based on the +<>. -*Grammar:* +*Grammar* [source,ANTLR4] ---- +declaration : type ID assignment? (',' ID assignment?)*; type: ID ('[' ']')*; -declaration : type ID (',' ID)*; +assignment: '=' expression; ---- -*Examples:* -[source,Java] +*Examples* + +* Different variations of variable declaration. ++ +[source,Painless] ---- -int x; // Declare a variable with type int and id x -List y; // Declare a variable with type List and id y -int x, y, z; // Declare variables with type int and ids x, y, and z -def[] d; // Declare the variable d with type def[] -int i = 10; // Declare the int variable i and set it to the int literal 10 +<1> int x; +<2> List y; +<3> int x, y, z; +<4> def[] d; +<5> int i = 10; ---- ++ +<1> declare a variable of type `int` and identifier `x` +<2> declare a variable of type `List` and identifier `y` +<3> declare three variables of type `int` and identifiers `x`, `y`, `z` +<4> declare a variable of type `def[]` and identifier `d` +<5> declare a variable of type `int` and identifier `i`; + assign the integer literal `10` to `i` -[[variable-assignment]] +[[assignment]] ==== Assignment -Use the equals operator (`=`) to assign a value to a variable. The format is -`identifier-name = value`. Any value expression can be assigned to any variable -as long as the types match or the expression's type can be implicitly cast to -the variable's type. An error occurs if the types do not match. +Use the `equals` operator (`=`) to assign a value to a variable. Any expression +that produces a value can be assigned to any variable as long as the +<> are the same or the resultant +<> can be implicitly <> to +the variable <>. Otherwise, an error will occur. +<> values are shallow-copied when assigned. -*Grammar:* +*Grammar* [source,ANTLR4] ---- assignment: ID '=' expression ---- - -*Examples:* - -Assigning a literal of the appropriate type directly to a declared variable. - -[source,Java] ----- -int i;   // Declare an int i -i = 10;  // Set the int i to the int literal 10 ----- - -Immediately assigning a value when declaring a variable. - -[source,Java] ----- -int i = 10; // Declare the int variable i and set it the int literal 1 -double j = 2.0; // Declare the double variable j and set it to the double - // literal 2.0 ----- - -Assigning a variable of one primitive type to another variable of the same -type. - -[source,Java] ----- -int i = 10; // Declare the int variable i and set it to the int literal 10 -int j = i;  // Declare the int variable j and set it to the int variable i ----- - -Assigning a reference type to a new heap allocation with the `new` operator. - -[source,Java] ----- -ArrayList l = new ArrayList();  // Declare an ArrayList variable l and set it - // to a newly allocated ArrayList -Map m = new HashMap(); // Declare a Map variable m and set it - // to a newly allocated HashMap ----- - -Assigning a variable of one reference type to another variable of the same type. - -[source,Java] ----- -List l = new ArrayList(); // Declare List variable l and set it a newly - // allocated ArrayList -List k = l;  // Declare List variable k and set it to the - // value of the List variable l -List m;                   // Declare List variable m and set it the - // default value null -m = k;                    // Set the value of List variable m to the value - // of List variable k ----- +*Examples* + +* Variable assignment with an <>. ++ +[source,Painless] +---- +<1> int i; +<2> i = 10; +---- ++ +<1> declare `int i` +<2> assign `10` to `i` ++ +* <> combined with immediate variable assignment. ++ +[source,Painless] +---- +<1> int i = 10; +<2> double j = 2.0; +---- ++ +<1> declare `int i`; assign `10` to `i` +<2> declare `double j`; assign `2.0` to `j` ++ +* Assignment of one variable to another using +<>. ++ +[source,Painless] +---- +<1> int i = 10; +<2> int j = i; +---- ++ +<1> declare `int i`; assign `10` to `i` +<2> declare `int j`; assign `j` to `i` ++ +* Assignment with <> using the +<>. ++ +[source,Painless] +---- +<1> ArrayList l = new ArrayList(); +<2> Map m = new HashMap(); +---- ++ +<1> declare `ArrayList l`; assign a newly-allocated `Arraylist` to `l` +<2> declare `Map m`; assign a newly-allocated `HashMap` to `m` + with an implicit cast to `Map` ++ +* Assignment of one variable to another using +<>. ++ +[source,Painless] +---- +<1> List l = new ArrayList(); +<2> List k = l; +<3> List m; +<4> m = k; +---- ++ +<1> declare `List l`; assign a newly-allocated `Arraylist` to `l` + with an implicit cast to `List` +<2> declare `List k`; assign a shallow-copy of `l` to `k` +<3> declare `List m`; +<4> assign a shallow-copy of `k` to `m` diff --git a/docs/plugins/analysis.asciidoc b/docs/plugins/analysis.asciidoc index 3c3df021de5cb..c09c48640ea3d 100644 --- a/docs/plugins/analysis.asciidoc +++ b/docs/plugins/analysis.asciidoc @@ -53,6 +53,7 @@ A number of analysis plugins have been contributed by our community: * https://github.com/duydo/elasticsearch-analysis-vietnamese[Vietnamese Analysis Plugin] (by Duy Do) * https://github.com/ofir123/elasticsearch-network-analysis[Network Addresses Analysis Plugin] (by Ofir123) * https://github.com/medcl/elasticsearch-analysis-string2int[String2Integer Analysis Plugin] (by Medcl) +* https://github.com/ZarHenry96/elasticsearch-dandelion-plugin[Dandelion Analysis Plugin] (by ZarHenry96) include::analysis-icu.asciidoc[] diff --git a/docs/reference/mapping/types/token-count.asciidoc b/docs/reference/mapping/types/token-count.asciidoc index da4220f4bb401..6f3295fab5ebb 100644 --- a/docs/reference/mapping/types/token-count.asciidoc +++ b/docs/reference/mapping/types/token-count.asciidoc @@ -81,7 +81,7 @@ Defaults to `true`. <>:: - Should the field be searchable? Accepts `not_analyzed` (default) and `no`. + Should the field be searchable? Accepts `true` (default) and `false`. <>:: diff --git a/docs/reference/migration/migrate_7_0/api.asciidoc b/docs/reference/migration/migrate_7_0/api.asciidoc index ec4778f9aa691..2da822a7e5e62 100644 --- a/docs/reference/migration/migrate_7_0/api.asciidoc +++ b/docs/reference/migration/migrate_7_0/api.asciidoc @@ -22,7 +22,14 @@ The following parameters starting with underscore have been removed: Instead of these removed parameters, use their non camel case equivalents without starting underscore, e.g. use `version_type` instead of `_version_type` or `versionType`. - ==== The parameter `fields` deprecated in 6.x has been removed from Bulk request and Update request. The Update API returns `400 - Bad request` if request contains unknown parameters (instead of ignored in the previous version). + +[[remove-suggest-metric]] +==== Remove support for `suggest` metric/index metric in indices stats and nodes stats APIs + +Previously, `suggest` stats were folded into `search` stats. Support for the +`suggest` metric on the indices stats and nodes stats APIs remained for +backwards compatibility. Backwards support for the `suggest` metric was +deprecated in 6.3.0 and now removed in 7.0.0. diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 27768f1bbac3c..a5fe1cb94b9ee 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8d6b7c2cbd9ba..7962563f742fe 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME -distributionSha256Sum=6ac2f8f9302f50241bf14cc5f4a3d88504ad20e61bb98c5fd048f7723b61397e +distributionSha256Sum=203f4537da8b8075e38c036a6d14cb71b1149de5bf0a8f6db32ac2833a1d1294 diff --git a/qa/vagrant/src/test/resources/packaging/tests/30_deb_package.bats b/qa/vagrant/src/test/resources/packaging/tests/30_deb_package.bats index e4a56ccb14151..59aaa3e8a072f 100644 --- a/qa/vagrant/src/test/resources/packaging/tests/30_deb_package.bats +++ b/qa/vagrant/src/test/resources/packaging/tests/30_deb_package.bats @@ -191,8 +191,8 @@ setup() { assert_file_not_exist "/usr/share/elasticsearch" - assert_file_not_exist "/usr/share/doc/elasticsearch" - assert_file_not_exist "/usr/share/doc/elasticsearch/copyright" + assert_file_not_exist "/usr/share/doc/elasticsearch-oss" + assert_file_not_exist "/usr/share/doc/elasticsearch-oss/copyright" } @test "[DEB] package has been completly removed" { diff --git a/qa/vagrant/src/test/resources/packaging/utils/packages.bash b/qa/vagrant/src/test/resources/packaging/utils/packages.bash index cd8b25fad7940..a214cd6940f63 100644 --- a/qa/vagrant/src/test/resources/packaging/utils/packages.bash +++ b/qa/vagrant/src/test/resources/packaging/utils/packages.bash @@ -116,9 +116,10 @@ verify_package_installation() { # Env file assert_file "/etc/default/elasticsearch" f root elasticsearch 660 - # Doc files - assert_file "/usr/share/doc/elasticsearch" d root root 755 - assert_file "/usr/share/doc/elasticsearch/copyright" f root root 644 + # Machine-readable debian/copyright file + local copyrightDir=$(readlink -f /usr/share/doc/$PACKAGE_NAME) + assert_file $copyrightDir d root root 755 + assert_file "$copyrightDir/copyright" f root root 644 fi if is_rpm; then diff --git a/qa/vagrant/src/test/resources/packaging/utils/utils.bash b/qa/vagrant/src/test/resources/packaging/utils/utils.bash index 413cecb4e62a2..4e3fdf5bd5560 100644 --- a/qa/vagrant/src/test/resources/packaging/utils/utils.bash +++ b/qa/vagrant/src/test/resources/packaging/utils/utils.bash @@ -254,6 +254,7 @@ clean_before_test() { "/etc/sysconfig/elasticsearch" \ "/var/run/elasticsearch" \ "/usr/share/doc/elasticsearch" \ + "/usr/share/doc/elasticsearch-oss" \ "/tmp/elasticsearch" \ "/usr/lib/systemd/system/elasticsearch.conf" \ "/usr/lib/tmpfiles.d/elasticsearch.conf" \ diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStats.java b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStats.java index 6379f8da21aa2..e244369c0c312 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStats.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStats.java @@ -152,9 +152,6 @@ public CommonStats(CommonStatsFlags flags) { case Translog: translog = new TranslogStats(); break; - case Suggest: - // skip - break; case RequestCache: requestCache = new RequestCacheStats(); break; @@ -213,9 +210,6 @@ public CommonStats(IndicesQueryCache indicesQueryCache, IndexShard indexShard, C case Translog: translog = indexShard.translogStats(); break; - case Suggest: - // skip - break; case RequestCache: requestCache = indexShard.requestCache().stats(); break; diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStatsFlags.java b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStatsFlags.java index b222fed7f0fff..a53cc0b339de8 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStatsFlags.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/CommonStatsFlags.java @@ -221,7 +221,7 @@ public enum Flag { Completion("completion", 11), Segments("segments", 12), Translog("translog", 13), - Suggest("suggest", 14), // unused + // 14 was previously used for Suggest RequestCache("request_cache", 15), Recovery("recovery", 16); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsRequest.java b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsRequest.java index e4357f7ba126c..9f401b6312c46 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsRequest.java @@ -229,15 +229,6 @@ public boolean translog() { return flags.isSet(Flag.Translog); } - public IndicesStatsRequest suggest(boolean suggest) { - flags.set(Flag.Suggest, suggest); - return this; - } - - public boolean suggest() { - return flags.isSet(Flag.Suggest); - } - public IndicesStatsRequest requestCache(boolean requestCache) { flags.set(Flag.RequestCache, requestCache); return this; diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/TransportIndicesStatsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/TransportIndicesStatsAction.java index 50d7712da11d0..eeefe793db701 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/stats/TransportIndicesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/stats/TransportIndicesStatsAction.java @@ -148,9 +148,6 @@ protected ShardStats shardOperation(IndicesStatsRequest request, ShardRouting sh if (request.translog()) { flags.set(CommonStatsFlags.Flag.Translog); } - if (request.suggest()) { - flags.set(CommonStatsFlags.Flag.Suggest); - } if (request.requestCache()) { flags.set(CommonStatsFlags.Flag.RequestCache); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java index 624f7d1b9dcda..14c8655e48c18 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java @@ -146,10 +146,6 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC for (final String indexMetric : indexMetrics) { final Consumer handler = FLAGS.get(indexMetric); if (handler != null) { - if ("suggest".equals(indexMetric)) { - deprecationLogger.deprecated( - "the suggest index metric is deprecated on the nodes stats API [" + request.uri() + "]"); - } handler.accept(flags); } else { invalidIndexMetrics.add(indexMetric); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java index f868a8d6c4397..fd70b7461ec67 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java @@ -62,7 +62,6 @@ public String getName() { metrics.put("store", r -> r.store(true)); metrics.put("indexing", r -> r.indexing(true)); metrics.put("search", r -> r.search(true)); - metrics.put("suggest", r -> r.search(true)); metrics.put("get", r -> r.get(true)); metrics.put("merge", r -> r.merge(true)); metrics.put("refresh", r -> r.refresh(true)); @@ -102,9 +101,6 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC for (final String metric : metrics) { final Consumer consumer = METRICS.get(metric); if (consumer != null) { - if ("suggest".equals(metric)) { - deprecationLogger.deprecated("the suggest metric is deprecated on the indices stats API [" + request.uri() + "]"); - } consumer.accept(indicesStatsRequest); } else { invalidMetrics.add(metric); diff --git a/server/src/test/java/org/elasticsearch/common/unit/ByteSizeValueTests.java b/server/src/test/java/org/elasticsearch/common/unit/ByteSizeValueTests.java index 27b2deb4656d8..e193ea34498cf 100644 --- a/server/src/test/java/org/elasticsearch/common/unit/ByteSizeValueTests.java +++ b/server/src/test/java/org/elasticsearch/common/unit/ByteSizeValueTests.java @@ -223,25 +223,36 @@ protected Reader instanceReader() { } @Override - protected ByteSizeValue mutateInstance(ByteSizeValue instance) throws IOException { - long size = instance.getSize(); - ByteSizeUnit unit = instance.getUnit(); + protected ByteSizeValue mutateInstance(final ByteSizeValue instance) { + final long instanceSize = instance.getSize(); + final ByteSizeUnit instanceUnit = instance.getUnit(); + final long mutateSize; + final ByteSizeUnit mutateUnit; switch (between(0, 1)) { case 0: - long unitBytes = unit.toBytes(1); - size = randomValueOtherThan(size, () -> randomNonNegativeLong() / unitBytes); + final long unitBytes = instanceUnit.toBytes(1); + mutateSize = randomValueOtherThan(instanceSize, () -> randomNonNegativeLong() / unitBytes); + mutateUnit = instanceUnit; break; case 1: - unit = randomValueOtherThan(unit, () -> randomFrom(ByteSizeUnit.values())); - long newUnitBytes = unit.toBytes(1); - if (size >= Long.MAX_VALUE / newUnitBytes) { - size = randomValueOtherThan(size, () -> randomNonNegativeLong() / newUnitBytes); + mutateUnit = randomValueOtherThan(instanceUnit, () -> randomFrom(ByteSizeUnit.values())); + final long newUnitBytes = mutateUnit.toBytes(1); + /* + * If size is zero we can not reuse zero because zero with any unit will be equal to zero with any other unit so in this case we + * need to randomize a new size. Additionally, if the size unit pair is such that the representation would be such that the + * number of represented bytes would exceed Long.Max_VALUE, we have to randomize a new size too. + */ + if (instanceSize == 0 || instanceSize >= Long.MAX_VALUE / newUnitBytes) { + mutateSize = randomValueOtherThanMany( + v -> v == instanceSize && v >= Long.MAX_VALUE / newUnitBytes, () -> randomNonNegativeLong() / newUnitBytes); + } else { + mutateSize = instanceSize; } break; default: throw new AssertionError("Invalid randomisation branch"); } - return new ByteSizeValue(size, unit); + return new ByteSizeValue(mutateSize, mutateUnit); } public void testParse() { diff --git a/server/src/test/java/org/elasticsearch/indices/stats/IndexStatsIT.java b/server/src/test/java/org/elasticsearch/indices/stats/IndexStatsIT.java index ad2095a6dd073..4d0d0d6ff3fd9 100644 --- a/server/src/test/java/org/elasticsearch/indices/stats/IndexStatsIT.java +++ b/server/src/test/java/org/elasticsearch/indices/stats/IndexStatsIT.java @@ -589,10 +589,6 @@ public void testAllFlags() throws Exception { IndicesStatsResponse stats = builder.execute().actionGet(); for (Flag flag : values) { - if (flag == Flag.Suggest) { - // suggest flag is unused - continue; - } assertThat(isSet(flag, stats.getPrimaries()), equalTo(false)); assertThat(isSet(flag, stats.getTotal()), equalTo(false)); } @@ -628,10 +624,6 @@ public void testAllFlags() throws Exception { } for (Flag flag : EnumSet.complementOf(flags)) { // check the complement - if (flag == Flag.Suggest) { - // suggest flag is unused - continue; - } assertThat(isSet(flag, stats.getPrimaries()), equalTo(false)); assertThat(isSet(flag, stats.getTotal()), equalTo(false)); } @@ -684,7 +676,7 @@ public void testEncodeDecodeCommonStats() throws IOException { public void testFlagOrdinalOrder() { Flag[] flags = new Flag[]{Flag.Store, Flag.Indexing, Flag.Get, Flag.Search, Flag.Merge, Flag.Flush, Flag.Refresh, Flag.QueryCache, Flag.FieldData, Flag.Docs, Flag.Warmer, Flag.Completion, Flag.Segments, - Flag.Translog, Flag.Suggest, Flag.RequestCache, Flag.Recovery}; + Flag.Translog, Flag.RequestCache, Flag.Recovery}; assertThat(flags.length, equalTo(Flag.values().length)); for (int i = 0; i < flags.length; i++) { @@ -935,8 +927,6 @@ private static void set(Flag flag, IndicesStatsRequestBuilder builder, boolean s case Translog: builder.setTranslog(set); break; - case Suggest: // unused - break; case RequestCache: builder.setRequestCache(set); break; @@ -979,8 +969,6 @@ private static boolean isSet(Flag flag, CommonStats response) { return response.getSegments() != null; case Translog: return response.getTranslog() != null; - case Suggest: // unused - return true; case RequestCache: return response.getRequestCache() != null; case Recovery: diff --git a/server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsActionTests.java index 90e0cfa656b7e..f1d7686838cea 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsActionTests.java @@ -148,14 +148,4 @@ public void testIndexMetricsRequestOnAllRequest() throws IOException { containsString("request [/_nodes/stats] contains index metrics [" + indexMetric + "] but all stats requested"))); } - public void testSuggestIsDeprecated() throws IOException { - final Map params = - Stream.of(Tuple.tuple("metric", "indices"), Tuple.tuple("index_metric", "suggest")) - .collect(Collectors.toMap(Tuple::v1, Tuple::v2)); - final RestRequest request = - new FakeRestRequest.Builder(xContentRegistry()).withPath("/_nodes/stats").withParams(params).build(); - action.prepareRequest(request, mock(NodeClient.class)); - assertWarnings("the suggest index metric is deprecated on the nodes stats API [/_nodes/stats]" ); - } - } diff --git a/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsActionTests.java index 38edbee673ee5..f9eb93b64bef2 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsActionTests.java @@ -84,11 +84,4 @@ public void testAllRequestWithOtherMetrics() throws IOException { assertThat(e, hasToString(containsString("request [/_stats] contains _all and individual metrics [_all," + metric + "]"))); } - public void testSuggestIsDeprecated() throws IOException { - final Map params = Collections.singletonMap("metric", "suggest"); - final RestRequest request = new FakeRestRequest.Builder(xContentRegistry()).withPath("/_stats").withParams(params).build(); - action.prepareRequest(request, mock(NodeClient.class)); - assertWarnings("the suggest metric is deprecated on the indices stats API [/_stats]"); - } - } diff --git a/x-pack/plugin/sql/jdbc/build.gradle b/x-pack/plugin/sql/jdbc/build.gradle index acaf10d3a2325..2cc7946d9b9c2 100644 --- a/x-pack/plugin/sql/jdbc/build.gradle +++ b/x-pack/plugin/sql/jdbc/build.gradle @@ -45,11 +45,23 @@ jar { } dependencies { - bundled (xpackProject('plugin:sql:sql-shared-client')) { - transitive = false - } - bundled (xpackProject('plugin:sql:sql-proto')) { - transitive = false + + // Eclipse doesn't know how to deal with these bundled deependencies so make them compile + // dependencies if we are running in Eclipse + if (isEclipse) { + compile (xpackProject('plugin:sql:sql-shared-client')) { + transitive = false + } + compile (xpackProject('plugin:sql:sql-proto')) { + transitive = false + } + } else { + bundled (xpackProject('plugin:sql:sql-shared-client')) { + transitive = false + } + bundled (xpackProject('plugin:sql:sql-proto')) { + transitive = false + } } compile (project(':server')) { transitive = false