Skip to content

Commit dea60fe

Browse files
committed
Merge remote-tracking branch 'es/master' into ccr
* es/master: [Docs] Fix explanation for `from` and `size` example (#28320) Adapt bwc version after backport #28358 Always return the after_key in composite aggregation response (#28358) Adds test name to MockPageCacheRecycler exception (#28359) Adds a note in the `terms` aggregation docs regarding pagination (#28360) [Test] Fix DiscoveryNodesTests.testDeltas() (#28361) Update packaging tests to work with meta plugins (#28336) Remove Painless Type from MethodWriter in favor of Java Class. (#28346) [Doc] Fixs typo in reverse-nested-aggregation.asciidoc (#28348) Reindex: Shore up rethrottle test Only assert single commit iff index created on 6.2 isHeldByCurrentThread should return primitive bool [Docs] Clarify `html` encoder in highlighting.asciidoc (#27766) Fix GeoDistance query example (#28355) Settings: Introduce settings updater for a list of settings (#28338) Adapt bwc version after backport #28310
2 parents 5b2dcee + 261fb6a commit dea60fe

File tree

30 files changed

+504
-123
lines changed

30 files changed

+504
-123
lines changed

docs/java-api/query-dsl/geo-distance-query.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ See {ref}/query-dsl-geo-distance-query.html[Geo Distance Query]
55

66
["source","java",subs="attributes,callouts,macros"]
77
--------------------------------------------------
8-
include-tagged::{query-dsl-test}[geo_bounding_box]
8+
include-tagged::{query-dsl-test}[geo_distance]
99
--------------------------------------------------
1010
<1> field
1111
<2> center point

docs/reference/aggregations/bucket/composite-aggregation.asciidoc

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,10 @@ GET /_search
394394
...
395395
"aggregations": {
396396
"my_buckets": {
397+
"after_key": { <1>
398+
"date": 1494288000000,
399+
"product": "mad max"
400+
},
397401
"buckets": [
398402
{
399403
"key": {
@@ -403,7 +407,7 @@ GET /_search
403407
"doc_count": 1
404408
},
405409
{
406-
"key": { <1>
410+
"key": {
407411
"date": 1494288000000,
408412
"product": "mad max"
409413
},
@@ -418,9 +422,14 @@ GET /_search
418422

419423
<1> The last composite bucket returned by the query.
420424

425+
NOTE: The `after_key` is equals to the last bucket returned in the response before
426+
any filtering that could be done by <<search-aggregations-pipeline, Pipeline aggregations>>.
427+
If all buckets are filtered/removed by a pipeline aggregation, the `after_key` will contain
428+
the last bucket before filtering.
429+
421430
The `after` parameter can be used to retrieve the composite buckets that are **after**
422431
the last composite buckets returned in a previous round.
423-
For the example below the last bucket is `"key": [1494288000000, "mad max"]` so the next
432+
For the example below the last bucket can be found in `after_key` and the next
424433
round of result can be retrieved with:
425434

426435
[source,js]
@@ -485,6 +494,10 @@ GET /_search
485494
...
486495
"aggregations": {
487496
"my_buckets": {
497+
"after_key": {
498+
"date": 1494201600000,
499+
"product": "rocky"
500+
},
488501
"buckets": [
489502
{
490503
"key": {

docs/reference/aggregations/bucket/reverse-nested-aggregation.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ GET /issues/_search
9393
// TEST[s/_search/_search\?filter_path=aggregations/]
9494

9595
As you can see above, the `reverse_nested` aggregation is put in to a `nested` aggregation as this is the only place
96-
in the dsl where the `reversed_nested` aggregation can be used. Its sole purpose is to join back to a parent doc higher
96+
in the dsl where the `reverse_nested` aggregation can be used. Its sole purpose is to join back to a parent doc higher
9797
up in the nested structure.
9898

9999
<1> A `reverse_nested` aggregation that joins back to the root / main document level, because no `path` has been defined.

docs/reference/aggregations/bucket/terms-aggregation.asciidoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ This means that if the number of unique terms is greater than `size`, the return
114114
(it could be that the term counts are slightly off and it could even be that a term that should have been in the top
115115
size buckets was not returned).
116116

117+
NOTE: If you want to retrieve **all** terms or all combinations of terms in a nested `terms` aggregation
118+
you should use the <<search-aggregations-bucket-composite-aggregation,Composite>> aggregation which
119+
allows to paginate over all possible terms rather than setting a size greater than the cardinality of the field in the
120+
`terms` aggregation. The `terms` aggregation is meant to return the `top` terms and does not allow pagination.
121+
117122
[[search-aggregations-bucket-terms-aggregation-approximate-counts]]
118123
==== Document counts are approximate
119124

docs/reference/getting-started.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ GET /bank/_search
858858

859859
Note that if `size` is not specified, it defaults to 10.
860860

861-
This example does a `match_all` and returns documents 11 through 20:
861+
This example does a `match_all` and returns documents 10 through 19:
862862

863863
[source,js]
864864
--------------------------------------------------

docs/reference/search/request/highlighting.asciidoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ You can specify the locale to use with `boundary_scanner_locale`.
142142
boundary_scanner_locale:: Controls which locale is used to search for sentence
143143
and word boundaries.
144144

145-
encoder:: Indicates if the highlighted text should be HTML encoded:
146-
`default` (no encoding) or `html` (escapes HTML highlighting tags).
145+
encoder:: Indicates if the snippet should be HTML encoded:
146+
`default` (no encoding) or `html` (HTML-escape the snippet text and then
147+
insert the highlighting tags)
147148

148149
fields:: Specifies the fields to retrieve highlights for. You can use wildcards
149150
to specify fields. For example, you could specify `comment_*` to

modules/lang-painless/src/main/java/org/elasticsearch/painless/MethodWriter.java

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public final class MethodWriter extends GeneratorAdapter {
8181
private final BitSet statements;
8282
private final CompilerSettings settings;
8383

84-
private final Deque<List<org.objectweb.asm.Type>> stringConcatArgs =
84+
private final Deque<List<Type>> stringConcatArgs =
8585
(INDY_STRING_CONCAT_BOOTSTRAP_HANDLE == null) ? null : new ArrayDeque<>();
8686

8787
public MethodWriter(int access, Method method, ClassVisitor cw, BitSet statements, CompilerSettings settings) {
@@ -200,7 +200,7 @@ private void writeCast(Class<?> from, Class<?> to) {
200200
* Proxy the box method to use valueOf instead to ensure that the modern boxing methods are used.
201201
*/
202202
@Override
203-
public void box(org.objectweb.asm.Type type) {
203+
public void box(Type type) {
204204
valueOf(type);
205205
}
206206

@@ -252,10 +252,10 @@ public int writeNewStrings() {
252252
}
253253
}
254254

255-
public void writeAppendStrings(final Definition.Type type) {
255+
public void writeAppendStrings(Class<?> clazz) {
256256
if (INDY_STRING_CONCAT_BOOTSTRAP_HANDLE != null) {
257257
// Java 9+: record type information
258-
stringConcatArgs.peek().add(type.type);
258+
stringConcatArgs.peek().add(getType(clazz));
259259
// prevent too many concat args.
260260
// If there are too many, do the actual concat:
261261
if (stringConcatArgs.peek().size() >= MAX_INDY_STRING_CONCAT_ARGS) {
@@ -266,24 +266,24 @@ public void writeAppendStrings(final Definition.Type type) {
266266
}
267267
} else {
268268
// Java 8: push a StringBuilder append
269-
if (type.clazz == boolean.class) invokeVirtual(STRINGBUILDER_TYPE, STRINGBUILDER_APPEND_BOOLEAN);
270-
else if (type.clazz == char.class) invokeVirtual(STRINGBUILDER_TYPE, STRINGBUILDER_APPEND_CHAR);
271-
else if (type.clazz == byte.class ||
272-
type.clazz == short.class ||
273-
type.clazz == int.class) invokeVirtual(STRINGBUILDER_TYPE, STRINGBUILDER_APPEND_INT);
274-
else if (type.clazz == long.class) invokeVirtual(STRINGBUILDER_TYPE, STRINGBUILDER_APPEND_LONG);
275-
else if (type.clazz == float.class) invokeVirtual(STRINGBUILDER_TYPE, STRINGBUILDER_APPEND_FLOAT);
276-
else if (type.clazz == double.class) invokeVirtual(STRINGBUILDER_TYPE, STRINGBUILDER_APPEND_DOUBLE);
277-
else if (type.clazz == String.class) invokeVirtual(STRINGBUILDER_TYPE, STRINGBUILDER_APPEND_STRING);
278-
else invokeVirtual(STRINGBUILDER_TYPE, STRINGBUILDER_APPEND_OBJECT);
269+
if (clazz == boolean.class) invokeVirtual(STRINGBUILDER_TYPE, STRINGBUILDER_APPEND_BOOLEAN);
270+
else if (clazz == char.class) invokeVirtual(STRINGBUILDER_TYPE, STRINGBUILDER_APPEND_CHAR);
271+
else if (clazz == byte.class ||
272+
clazz == short.class ||
273+
clazz == int.class) invokeVirtual(STRINGBUILDER_TYPE, STRINGBUILDER_APPEND_INT);
274+
else if (clazz == long.class) invokeVirtual(STRINGBUILDER_TYPE, STRINGBUILDER_APPEND_LONG);
275+
else if (clazz == float.class) invokeVirtual(STRINGBUILDER_TYPE, STRINGBUILDER_APPEND_FLOAT);
276+
else if (clazz == double.class) invokeVirtual(STRINGBUILDER_TYPE, STRINGBUILDER_APPEND_DOUBLE);
277+
else if (clazz == String.class) invokeVirtual(STRINGBUILDER_TYPE, STRINGBUILDER_APPEND_STRING);
278+
else invokeVirtual(STRINGBUILDER_TYPE, STRINGBUILDER_APPEND_OBJECT);
279279
}
280280
}
281281

282282
public void writeToStrings() {
283283
if (INDY_STRING_CONCAT_BOOTSTRAP_HANDLE != null) {
284284
// Java 9+: use type information and push invokeDynamic
285-
final String desc = org.objectweb.asm.Type.getMethodDescriptor(STRING_TYPE,
286-
stringConcatArgs.pop().stream().toArray(org.objectweb.asm.Type[]::new));
285+
final String desc = Type.getMethodDescriptor(STRING_TYPE,
286+
stringConcatArgs.pop().stream().toArray(Type[]::new));
287287
invokeDynamic("concat", desc, INDY_STRING_CONCAT_BOOTSTRAP_HANDLE);
288288
} else {
289289
// Java 8: call toString() on StringBuilder
@@ -292,9 +292,9 @@ public void writeToStrings() {
292292
}
293293

294294
/** Writes a dynamic binary instruction: returnType, lhs, and rhs can be different */
295-
public void writeDynamicBinaryInstruction(Location location, Definition.Type returnType, Definition.Type lhs, Definition.Type rhs,
295+
public void writeDynamicBinaryInstruction(Location location, Class<?> returnType, Class<?> lhs, Class<?> rhs,
296296
Operation operation, int flags) {
297-
org.objectweb.asm.Type methodType = org.objectweb.asm.Type.getMethodType(returnType.type, lhs.type, rhs.type);
297+
Type methodType = Type.getMethodType(getType(returnType), getType(lhs), getType(rhs));
298298

299299
switch (operation) {
300300
case MUL:
@@ -310,7 +310,7 @@ public void writeDynamicBinaryInstruction(Location location, Definition.Type ret
310310
// if either side is primitive, then the + operator should always throw NPE on null,
311311
// so we don't need a special NPE guard.
312312
// otherwise, we need to allow nulls for possible string concatenation.
313-
boolean hasPrimitiveArg = lhs.clazz.isPrimitive() || rhs.clazz.isPrimitive();
313+
boolean hasPrimitiveArg = lhs.isPrimitive() || rhs.isPrimitive();
314314
if (!hasPrimitiveArg) {
315315
flags |= DefBootstrap.OPERATOR_ALLOWS_NULL;
316316
}
@@ -343,26 +343,26 @@ public void writeDynamicBinaryInstruction(Location location, Definition.Type ret
343343
}
344344

345345
/** Writes a static binary instruction */
346-
public void writeBinaryInstruction(Location location, Definition.Type type, Operation operation) {
347-
if ((type.clazz == float.class || type.clazz == double.class) &&
346+
public void writeBinaryInstruction(Location location, Class<?> clazz, Operation operation) {
347+
if ( (clazz == float.class || clazz == double.class) &&
348348
(operation == Operation.LSH || operation == Operation.USH ||
349349
operation == Operation.RSH || operation == Operation.BWAND ||
350350
operation == Operation.XOR || operation == Operation.BWOR)) {
351351
throw location.createError(new IllegalStateException("Illegal tree structure."));
352352
}
353353

354354
switch (operation) {
355-
case MUL: math(GeneratorAdapter.MUL, type.type); break;
356-
case DIV: math(GeneratorAdapter.DIV, type.type); break;
357-
case REM: math(GeneratorAdapter.REM, type.type); break;
358-
case ADD: math(GeneratorAdapter.ADD, type.type); break;
359-
case SUB: math(GeneratorAdapter.SUB, type.type); break;
360-
case LSH: math(GeneratorAdapter.SHL, type.type); break;
361-
case USH: math(GeneratorAdapter.USHR, type.type); break;
362-
case RSH: math(GeneratorAdapter.SHR, type.type); break;
363-
case BWAND: math(GeneratorAdapter.AND, type.type); break;
364-
case XOR: math(GeneratorAdapter.XOR, type.type); break;
365-
case BWOR: math(GeneratorAdapter.OR, type.type); break;
355+
case MUL: math(GeneratorAdapter.MUL, getType(clazz)); break;
356+
case DIV: math(GeneratorAdapter.DIV, getType(clazz)); break;
357+
case REM: math(GeneratorAdapter.REM, getType(clazz)); break;
358+
case ADD: math(GeneratorAdapter.ADD, getType(clazz)); break;
359+
case SUB: math(GeneratorAdapter.SUB, getType(clazz)); break;
360+
case LSH: math(GeneratorAdapter.SHL, getType(clazz)); break;
361+
case USH: math(GeneratorAdapter.USHR, getType(clazz)); break;
362+
case RSH: math(GeneratorAdapter.SHR, getType(clazz)); break;
363+
case BWAND: math(GeneratorAdapter.AND, getType(clazz)); break;
364+
case XOR: math(GeneratorAdapter.XOR, getType(clazz)); break;
365+
case BWOR: math(GeneratorAdapter.OR, getType(clazz)); break;
366366
default:
367367
throw location.createError(new IllegalStateException("Illegal tree structure."));
368368
}
@@ -416,7 +416,7 @@ public void visitEnd() {
416416
* @param flavor type of call
417417
* @param params flavor-specific parameters
418418
*/
419-
public void invokeDefCall(String name, org.objectweb.asm.Type methodType, int flavor, Object... params) {
419+
public void invokeDefCall(String name, Type methodType, int flavor, Object... params) {
420420
Object[] args = new Object[params.length + 2];
421421
args[0] = settings.getInitialCallSiteDepth();
422422
args[1] = flavor;

modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EAssignment.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.elasticsearch.painless.Definition;
2626
import org.elasticsearch.painless.Definition.Cast;
2727
import org.elasticsearch.painless.Definition.Type;
28+
import org.elasticsearch.painless.Definition.def;
2829
import org.elasticsearch.painless.Globals;
2930
import org.elasticsearch.painless.Locals;
3031
import org.elasticsearch.painless.Location;
@@ -274,12 +275,12 @@ void write(MethodWriter writer, Globals globals) {
274275
writer.writeDup(lhs.accessElementCount(), catElementStackSize); // dup the top element and insert it
275276
// before concat helper on stack
276277
lhs.load(writer, globals); // read the current lhs's value
277-
writer.writeAppendStrings(lhs.actual); // append the lhs's value using the StringBuilder
278+
writer.writeAppendStrings(Definition.TypeToClass(lhs.actual)); // append the lhs's value using the StringBuilder
278279

279280
rhs.write(writer, globals); // write the bytecode for the rhs
280281

281-
if (!(rhs instanceof EBinary) || !((EBinary)rhs).cat) { // check to see if the rhs has already done a concatenation
282-
writer.writeAppendStrings(rhs.actual); // append the rhs's value since it's hasn't already
282+
if (!(rhs instanceof EBinary) || !((EBinary)rhs).cat) { // check to see if the rhs has already done a concatenation
283+
writer.writeAppendStrings(Definition.TypeToClass(rhs.actual)); // append the rhs's value since it's hasn't already
283284
}
284285

285286
writer.writeToStrings(); // put the value for string concat onto the stack
@@ -313,9 +314,9 @@ void write(MethodWriter writer, Globals globals) {
313314
// write the operation instruction for compound assignment
314315
if (promote.dynamic) {
315316
writer.writeDynamicBinaryInstruction(
316-
location, promote, DefType, DefType, operation, DefBootstrap.OPERATOR_COMPOUND_ASSIGNMENT);
317+
location, Definition.TypeToClass(promote), def.class, def.class, operation, DefBootstrap.OPERATOR_COMPOUND_ASSIGNMENT);
317318
} else {
318-
writer.writeBinaryInstruction(location, promote, operation);
319+
writer.writeBinaryInstruction(location, Definition.TypeToClass(promote), operation);
319320
}
320321

321322
writer.writeCast(back); // if necessary cast the promotion type value back to the lhs's type

modules/lang-painless/src/main/java/org/elasticsearch/painless/node/EBinary.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,13 +649,13 @@ void write(MethodWriter writer, Globals globals) {
649649
left.write(writer, globals);
650650

651651
if (!(left instanceof EBinary) || !((EBinary)left).cat) {
652-
writer.writeAppendStrings(left.actual);
652+
writer.writeAppendStrings(Definition.TypeToClass(left.actual));
653653
}
654654

655655
right.write(writer, globals);
656656

657657
if (!(right instanceof EBinary) || !((EBinary)right).cat) {
658-
writer.writeAppendStrings(right.actual);
658+
writer.writeAppendStrings(Definition.TypeToClass(right.actual));
659659
}
660660

661661
if (!cat) {
@@ -684,9 +684,10 @@ void write(MethodWriter writer, Globals globals) {
684684
if (originallyExplicit) {
685685
flags |= DefBootstrap.OPERATOR_EXPLICIT_CAST;
686686
}
687-
writer.writeDynamicBinaryInstruction(location, actual, left.actual, right.actual, operation, flags);
687+
writer.writeDynamicBinaryInstruction(location, Definition.TypeToClass(actual),
688+
Definition.TypeToClass(left.actual), Definition.TypeToClass(right.actual), operation, flags);
688689
} else {
689-
writer.writeBinaryInstruction(location, actual, operation);
690+
writer.writeBinaryInstruction(location, Definition.TypeToClass(actual), operation);
690691
}
691692
}
692693
}

0 commit comments

Comments
 (0)