Skip to content

Commit 4be1488

Browse files
committed
Merge branch 'master' into ccr
* master: Remove the index thread pool (#29556) Remove extra copy in ScriptDocValues.Strings Fix full cluster restart test recovery (#29545) Fix binary doc values fetching in _search (#29567) Mutes failing MovAvgIT tests Fix the assertion message for an incorrect current version. (#29572) Fix the version ID for v5.6.10. (#29570) Painless Spec Documentation Clean Up (#29441) Add versions 5.6.10 and 6.2.5 [TEST] test against scaled value instead of fixed epsilon in MovAvgIT Remove `flatSettings` support from request classes (#29560) MapperService to wrap a single DocumentMapper. (#29511) Fix dependency checks on libs when generating Eclipse configuration. (#29550) Add null_value support to geo_point type (#29451) Add documentation about the include_type_name option. (#29555) Enforce translog access via engine (#29542)
2 parents 566d182 + 2b47d67 commit 4be1488

File tree

84 files changed

+1034
-821
lines changed

Some content is hidden

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

84 files changed

+1034
-821
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,6 @@ private static Request resize(ResizeRequest resizeRequest) throws IOException {
572572

573573
static Request clusterPutSettings(ClusterUpdateSettingsRequest clusterUpdateSettingsRequest) throws IOException {
574574
Params parameters = Params.builder();
575-
parameters.withFlatSettings(clusterUpdateSettingsRequest.flatSettings());
576575
parameters.withTimeout(clusterUpdateSettingsRequest.timeout());
577576
parameters.withMasterTimeout(clusterUpdateSettingsRequest.masterNodeTimeout());
578577
HttpEntity entity = createEntity(clusterUpdateSettingsRequest, REQUEST_BODY_CONTENT_TYPE);
@@ -603,7 +602,6 @@ static Request indicesExist(GetIndexRequest request) {
603602
params.withLocal(request.local());
604603
params.withHuman(request.humanReadable());
605604
params.withIndicesOptions(request.indicesOptions());
606-
params.withFlatSettings(request.flatSettings());
607605
params.withIncludeDefaults(request.includeDefaults());
608606
return new Request(HttpHead.METHOD_NAME, endpoint, params.getParams(), null);
609607
}
@@ -613,7 +611,6 @@ static Request indexPutSettings(UpdateSettingsRequest updateSettingsRequest) thr
613611
parameters.withTimeout(updateSettingsRequest.timeout());
614612
parameters.withMasterTimeout(updateSettingsRequest.masterNodeTimeout());
615613
parameters.withIndicesOptions(updateSettingsRequest.indicesOptions());
616-
parameters.withFlatSettings(updateSettingsRequest.flatSettings());
617614
parameters.withPreserveExisting(updateSettingsRequest.isPreserveExisting());
618615

619616
String[] indices = updateSettingsRequest.indices() == null ? Strings.EMPTY_ARRAY : updateSettingsRequest.indices();

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ public void testIndicesExist() {
272272
Map<String, String> expectedParams = new HashMap<>();
273273
setRandomIndicesOptions(getIndexRequest::indicesOptions, getIndexRequest::indicesOptions, expectedParams);
274274
setRandomLocal(getIndexRequest, expectedParams);
275-
setRandomFlatSettings(getIndexRequest::flatSettings, expectedParams);
276275
setRandomHumanReadable(getIndexRequest, expectedParams);
277276
setRandomIncludeDefaults(getIndexRequest, expectedParams);
278277

@@ -1292,7 +1291,6 @@ private static void resizeTest(ResizeType resizeType, CheckedFunction<ResizeRequ
12921291
public void testClusterPutSettings() throws IOException {
12931292
ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest();
12941293
Map<String, String> expectedParams = new HashMap<>();
1295-
setRandomFlatSettings(request::flatSettings, expectedParams);
12961294
setRandomMasterTimeout(request, expectedParams);
12971295
setRandomTimeout(request::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
12981296

@@ -1344,7 +1342,6 @@ public void testIndexPutSettings() throws IOException {
13441342
String[] indices = randomBoolean() ? null : randomIndicesNames(0, 2);
13451343
UpdateSettingsRequest updateSettingsRequest = new UpdateSettingsRequest(indices);
13461344
Map<String, String> expectedParams = new HashMap<>();
1347-
setRandomFlatSettings(updateSettingsRequest::flatSettings, expectedParams);
13481345
setRandomMasterTimeout(updateSettingsRequest, expectedParams);
13491346
setRandomTimeout(updateSettingsRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
13501347
setRandomIndicesOptions(updateSettingsRequest::indicesOptions, updateSettingsRequest::indicesOptions, expectedParams);
@@ -1627,16 +1624,6 @@ private static void setRandomTimeout(Consumer<String> setter, TimeValue defaultT
16271624
}
16281625
}
16291626

1630-
private static void setRandomFlatSettings(Consumer<Boolean> setter, Map<String, String> expectedParams) {
1631-
if (randomBoolean()) {
1632-
boolean flatSettings = randomBoolean();
1633-
setter.accept(flatSettings);
1634-
if (flatSettings) {
1635-
expectedParams.put("flat_settings", String.valueOf(flatSettings));
1636-
}
1637-
}
1638-
}
1639-
16401627
private static void setRandomMasterTimeout(MasterNodeRequest<?> request, Map<String, String> expectedParams) {
16411628
if (randomBoolean()) {
16421629
String masterTimeout = randomTimeValue();

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,6 @@ public void testClusterPutSettings() throws IOException {
124124
request.masterNodeTimeout("1m"); // <2>
125125
// end::put-settings-request-masterTimeout
126126

127-
// tag::put-settings-request-flat-settings
128-
request.flatSettings(true); // <1>
129-
// end::put-settings-request-flat-settings
130-
131127
// tag::put-settings-execute
132128
ClusterUpdateSettingsResponse response = client.cluster().putSettings(request);
133129
// end::put-settings-execute

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
import org.elasticsearch.action.support.IndicesOptions;
5959
import org.elasticsearch.client.ESRestHighLevelClientTestCase;
6060
import org.elasticsearch.client.RestHighLevelClient;
61-
import org.elasticsearch.cluster.metadata.IndexMetaData;
6261
import org.elasticsearch.common.settings.Settings;
6362
import org.elasticsearch.common.unit.ByteSizeUnit;
6463
import org.elasticsearch.common.unit.ByteSizeValue;
@@ -114,8 +113,7 @@ public void testIndicesExist() throws IOException {
114113
request.local(false); // <1>
115114
request.humanReadable(true); // <2>
116115
request.includeDefaults(false); // <3>
117-
request.flatSettings(false); // <4>
118-
request.indicesOptions(indicesOptions); // <5>
116+
request.indicesOptions(indicesOptions); // <4>
119117
// end::indices-exists-request-optionals
120118

121119
// tag::indices-exists-response
@@ -1433,9 +1431,6 @@ public void testIndexPutSettings() throws Exception {
14331431
// end::put-settings-settings-source
14341432
}
14351433

1436-
// tag::put-settings-request-flat-settings
1437-
request.flatSettings(true); // <1>
1438-
// end::put-settings-request-flat-settings
14391434
// tag::put-settings-request-preserveExisting
14401435
request.setPreserveExisting(false); // <1>
14411436
// end::put-settings-request-preserveExisting

docs/java-rest/high-level/cluster/put_settings.asciidoc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,6 @@ include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-settings-setti
5454
==== Optional Arguments
5555
The following arguments can optionally be provided:
5656

57-
["source","java",subs="attributes,callouts,macros"]
58-
--------------------------------------------------
59-
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-settings-request-flat-settings]
60-
--------------------------------------------------
61-
<1> Whether the updated settings returned in the `ClusterUpdateSettings` should
62-
be in a flat format
63-
6457
["source","java",subs="attributes,callouts,macros"]
6558
--------------------------------------------------
6659
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-settings-request-timeout]

docs/java-rest/high-level/indices/indices_exists.asciidoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[indices-exists-req
2323
<1> Whether to return local information or retrieve the state from master node
2424
<2> Return result in a format suitable for humans
2525
<3> Whether to return all default setting for each of the indices
26-
<4> Return settings in flat format
27-
<5> Controls how unavailable indices are resolved and how wildcard expressions are expanded
26+
<4> Controls how unavailable indices are resolved and how wildcard expressions are expanded
2827

2928
[[java-rest-high-indices-sync]]
3029
==== Synchronous Execution

docs/java-rest/high-level/indices/put_settings.asciidoc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,6 @@ include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-settings-setti
5555
==== Optional Arguments
5656
The following arguments can optionally be provided:
5757

58-
["source","java",subs="attributes,callouts,macros"]
59-
--------------------------------------------------
60-
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-settings-request-flat-settings]
61-
--------------------------------------------------
62-
<1> Whether the updated settings returned in the `UpdateSettings` should
63-
be in a flat format
64-
6558
["source","java",subs="attributes,callouts,macros"]
6659
--------------------------------------------------
6760
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[put-settings-request-preserveExisting]

docs/painless/index.asciidoc

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,6 @@ include::../Versions.asciidoc[]
55

66
include::painless-getting-started.asciidoc[]
77

8-
// include::painless-examples.asciidoc[]
9-
10-
// include::painless-design.asciidoc[]
11-
128
include::painless-lang-spec.asciidoc[]
139

14-
include::painless-syntax.asciidoc[]
15-
1610
include::painless-api-reference.asciidoc[]
17-
18-
////
19-
Proposed Outline (WIP)
20-
Getting Started with Painless
21-
Accessing Doc Values
22-
Updating Fields
23-
Working with Dates
24-
Using Regular Expressions
25-
Debugging Painless Scripts
26-
27-
Example Scripts
28-
Using Painless in Script Fields
29-
Using Painless in Watches
30-
Using Painless in Function Score Queries
31-
Using Painless in Script Queries
32-
Using Painless When Updating Docs
33-
Using Painless When Reindexing
34-
35-
How Painless Works
36-
Painless Architecture
37-
Dispatching Functions
38-
39-
Painless Language Specification
40-
Painless API
41-
////
42-
43-
Painless API Reference
Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
["appendix",id="painless-api-reference"]
2-
= Painless API Reference
1+
[[painless-api-reference]]
2+
== Painless API Reference
33

4-
Painless has a strict whitelist for methods and
5-
classes to make sure that all painless scripts are secure and fast. Most of
6-
these methods are exposed directly from the JRE while others are part of
7-
Elasticsearch or Painless itself. Below is a list of all available methods
8-
grouped under the classes on which you can call them. Clicking on the method
9-
name takes you to the documentation for the method.
10-
11-
NOTE: Methods defined in the JRE also have a `(java 9)` link which can be used
12-
to see the method's documentation in Java 9 while clicking on the method's name
13-
goes to the Java 8 documentation. Usually these aren't different but it is
14-
worth going to the version that matches the version of Java you are using to
15-
run Elasticsearch just in case.
4+
Painless has a strict whitelist for methods and classes to ensure all
5+
painless scripts are secure. Most of these methods are exposed directly
6+
from the Java Runtime Enviroment (JRE) while others are part of
7+
Elasticsearch or Painless itself. Below is a list of all available
8+
classes grouped with their respected methods. Clicking on the method
9+
name takes you to the documentation for that specific method. Methods
10+
defined in the JRE also have a `(java 9)` link which can be used to see
11+
the method's documentation in Java 9.
1612

1713
include::painless-api-reference/index.asciidoc[]
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
[[painless-casting]]
2+
=== Casting
3+
4+
Casting is the conversion of one type to another. Implicit casts are casts that
5+
occur automatically, such as during an assignment operation. Explicit casts are
6+
casts where you use the casting operator to explicitly convert one type to
7+
another. This is necessary during operations where the cast cannot be inferred.
8+
9+
To cast to a new type, precede the expression by the new type enclosed in
10+
parentheses, for example
11+
`(int)x`.
12+
13+
The following sections specify the implicit casts that can be performed and the
14+
explicit casts that are allowed. The only other permitted cast is casting
15+
a single character `String` to a `char`.
16+
17+
*Grammar:*
18+
[source,ANTLR4]
19+
----
20+
cast: '(' TYPE ')' expression
21+
----
22+
23+
[[numeric-casting]]
24+
==== Numeric Casting
25+
26+
The following table shows the allowed implicit and explicit casts between
27+
numeric types. Read the table by row. To find out if you need to explicitly
28+
cast from type A to type B, find the row for type A and scan across to the
29+
column for type B.
30+
31+
IMPORTANT: Explicit casts between numeric types can result in some data loss. A
32+
smaller numeric type cannot necessarily accommodate the value from a larger
33+
numeric type. You might also lose precision when casting from integer types
34+
to floating point types.
35+
36+
|====
37+
| | byte | short | char | int | long | float | double
38+
| byte | | implicit | implicit | implicit | implicit | implicit | implicit
39+
| short | explicit | | explicit | implicit | implicit | implicit | implicit
40+
| char | explicit | explicit | | implicit | implicit | implicit | implicit
41+
| int | explicit | explicit | explicit | | implicit | implicit | implicit
42+
| long | explicit | explicit | explicit | explicit | | implicit | implicit
43+
| float | explicit | explicit | explicit | explicit | explicit | | implicit
44+
| double | explicit | explicit | explicit | explicit | explicit | explicit |
45+
|====
46+
47+
48+
Example(s)
49+
[source,Java]
50+
----
51+
int a = 1; // Declare int variable a and set it to the literal
52+
// value 1
53+
long b = a; // Declare long variable b and set it to int variable
54+
// a with an implicit cast to convert from int to long
55+
short c = (short)b; // Declare short variable c, explicitly cast b to a
56+
// short, and assign b to c
57+
byte d = a; // ERROR: Casting an int to a byte requires an explicit
58+
// cast
59+
double e = (double)a; // Explicitly cast int variable a to a double and assign
60+
// it to the double variable e. The explicit cast is
61+
// allowed, but it is not necessary.
62+
----
63+
64+
[[reference-casting]]
65+
==== Reference Casting
66+
67+
A reference type can be implicitly cast to another reference type as long as
68+
the type being cast _from_ is a descendant of the type being cast _to_. A
69+
reference type can be explicitly cast _to_ if the type being cast to is a
70+
descendant of the type being cast _from_.
71+
72+
*Examples:*
73+
[source,Java]
74+
----
75+
List x; // Declare List variable x
76+
ArrayList y = new ArrayList(); // Declare ArrayList variable y and assign it a
77+
// newly allocated ArrayList [1]
78+
x = y; // Assign Arraylist y to List x using an
79+
// implicit cast
80+
y = (ArrayList)x; // Explicitly cast List x to an ArrayList and
81+
// assign it to ArrayList y
82+
x = (List)y; // Set List x to ArrayList y using an explicit
83+
// cast (the explicit cast is not necessary)
84+
y = x; // ERROR: List x cannot be implicitly cast to
85+
// an ArrayList, an explicit cast is required
86+
Map m = y; // ERROR: Cannot implicitly or explicitly cast [2]
87+
// an ArrayList to a Map, no relationship
88+
// exists between the two types.
89+
----
90+
[1] `ArrayList` is a descendant of the `List` type.
91+
[2] `Map` is unrelated to the `List` and `ArrayList` types.
92+
93+
[[def-type-casting]]
94+
==== def Type Casting
95+
All primitive and reference types can always be implicitly cast to
96+
`def`. While it is possible to explicitly cast to `def`, it is not necessary.
97+
98+
However, it is not always possible to implicitly cast a `def` to other
99+
primitive and reference types. An explicit cast is required if an explicit
100+
cast would normally be required between the non-def types.
101+
102+
103+
*Examples:*
104+
[source,Java]
105+
----
106+
def x; // Declare def variable x and set it to null
107+
x = 3; // Set the def variable x to the literal 3 with an implicit
108+
// cast from int to def
109+
double a = x; // Declare double variable a and set it to def variable x,
110+
// which contains a double
111+
int b = x; // ERROR: Results in a run-time error because an explicit cast is
112+
// required to cast from a double to an int
113+
int c = (int)x; // Declare int variable c, explicitly cast def variable x to an
114+
// int, and assign x to c
115+
----
116+
117+
[[boxing-unboxing]]
118+
==== Boxing and Unboxing
119+
120+
Boxing is where a cast is used to convert a primitive type to its corresponding
121+
reference type. Unboxing is the reverse, converting a reference type to the
122+
corresponding primitive type.
123+
124+
There are two places Painless performs implicit boxing and unboxing:
125+
126+
* When you call methods, Painless automatically boxes and unboxes arguments
127+
so you can specify either primitive types or their corresponding reference
128+
types.
129+
* When you use the `def` type, Painless automatically boxes and unboxes as
130+
needed when converting to and from `def`.
131+
132+
The casting operator does not support any way to explicitly box a primitive
133+
type or unbox a reference type.
134+
135+
If a primitive type needs to be converted to a reference type, the Painless
136+
reference type API supports methods that can do that. However, under normal
137+
circumstances this should not be necessary.
138+
139+
*Examples:*
140+
[source,Java]
141+
----
142+
Integer x = 1; // ERROR: not a legal implicit cast
143+
Integer y = (Integer)1; // ERROR: not a legal explicit cast
144+
int a = new Integer(1); // ERROR: not a legal implicit cast
145+
int b = (int)new Integer(1); // ERROR: not a legal explicit cast
146+
----
147+
148+
[[promotion]]
149+
==== Promotion
150+
151+
Promotion is where certain operations require types to be either a minimum
152+
numerical type or for two (or more) types to be equivalent.
153+
The documentation for each operation that has these requirements
154+
includes promotion tables that describe how this is handled.
155+
156+
When an operation promotes a type or types, the resultant type
157+
of the operation is the promoted type. Types can be promoted to def
158+
at compile-time; however, at run-time, the resultant type will be the
159+
promotion of the types the `def` is representing.
160+
161+
*Examples:*
162+
[source,Java]
163+
----
164+
2 + 2.0 // Add the literal int 2 and the literal double 2.0. The literal
165+
// 2 is promoted to a double and the resulting value is a double.
166+
167+
def x = 1; // Declare def variable x and set it to the literal int 1 through
168+
// an implicit cast
169+
x + 2.0F // Add def variable x and the literal float 2.0.
170+
// At compile-time the types are promoted to def.
171+
// At run-time the types are promoted to float.
172+
----

0 commit comments

Comments
 (0)