Skip to content

Commit 05dd580

Browse files
Merge branch '8.17' into release-notes-8-17-9
2 parents a70363b + 817b05e commit 05dd580

File tree

6 files changed

+49
-0
lines changed

6 files changed

+49
-0
lines changed

docs/changelog/130776.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 130776
2+
summary: Fix msearch request parsing when index expression is null
3+
area: Search
4+
type: bug
5+
issues:
6+
- 129631

docs/reference/esql/esql-limitations.asciidoc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,17 @@ the <<esql-mv-functions,multivalue functions>>.
229229
=== Kibana limitations
230230

231231
include::esql-kibana.asciidoc[tag=limitations]
232+
233+
[discrete]
234+
[[esql-known-issues]]
235+
== Known issues
236+
237+
A bug in the ES|QL STATS command may yield incorrect results. The bug only happens in very specific cases that follow this pattern: `STATS ... BY keyword1, keyword2`, i.e. the command must have exactly two grouping fields, both keywords, where the first field has high cardinality (more than 65k distinct values).
238+
239+
The bug is described in detail in [this issue](https://github.com/elastic/elasticsearch/issues/130644).
240+
The problem was introduced in 8.16.0 and [fixed](https://github.com/elastic/elasticsearch/pull/130705) in 8.17.9, 8.18.7.
241+
242+
Possible workarounds include:
243+
* switching the order of the grouping keys (eg. `STATS ... BY keyword2, keyword1`, if the `keyword2` has a lower cardinality)
244+
* reducing the grouping key cardinality, by filtering out values before STATS
245+

docs/reference/release-notes/8.16.0.asciidoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,3 +517,13 @@ Snapshot/Restore::
517517
{esql}::
518518

519519
* Some valid queries using an `ENRICH` command can fail when a match field is used that is absent from some indices or shards, either with a 500 status code due to `NullPointerException` or `ClassCastException` or with a 400 status code and `IllegalArgumentException`. This is fixed in {es-pull}126187[#126187].
520+
521+
* A bug in the ES|QL STATS command may yield incorrect results. The bug only happens in very specific cases that follow this pattern: `STATS ... BY keyword1, keyword2`, i.e. the command must have exactly two grouping fields, both keywords, where the first field has high cardinality (more than 65k distinct values).
522+
523+
The bug is described in detail in [this issue](https://github.com/elastic/elasticsearch/issues/130644).
524+
The problem was introduced in 8.16.0 and [fixed](https://github.com/elastic/elasticsearch/pull/130705) in 8.17.9, 8.18.7.
525+
526+
Possible workarounds include:
527+
* switching the order of the grouping keys (eg. `STATS ... BY keyword2, keyword1`, if the `keyword2` has a lower cardinality)
528+
* reducing the grouping key cardinality, by filtering out values before STATS
529+

server/src/main/java/org/elasticsearch/common/xcontent/support/XContentMapValues.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,9 @@ public static Map<String, Object> nodeMapValue(Object node, String desc) {
567567
* Otherwise the node is treated as a comma-separated string.
568568
*/
569569
public static String[] nodeStringArrayValue(Object node) {
570+
if (node == null) {
571+
throw new ElasticsearchParseException("Expected a list of strings but got null");
572+
}
570573
if (isArray(node)) {
571574
List<?> list = (List<?>) node;
572575
String[] arr = new String[list.size()];

server/src/test/java/org/elasticsearch/action/search/MultiSearchRequestTests.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
package org.elasticsearch.action.search;
1111

12+
import org.elasticsearch.ElasticsearchParseException;
1213
import org.elasticsearch.action.support.IndicesOptions;
1314
import org.elasticsearch.common.CheckedBiConsumer;
1415
import org.elasticsearch.common.Strings;
@@ -594,6 +595,14 @@ public void testFailOnExtraCharacters() throws IOException {
594595
}
595596
}
596597

598+
public void testNullIndex() throws IOException {
599+
ElasticsearchParseException e = expectThrows(ElasticsearchParseException.class, () -> parseMultiSearchRequestFromString("""
600+
{"index": null}
601+
{ "query": {"match_all": {}}}
602+
""", null));
603+
assertThat(e.getMessage(), containsString("Expected a list of strings but got null"));
604+
}
605+
597606
private static MultiSearchRequest mutate(MultiSearchRequest searchRequest) throws IOException {
598607
MultiSearchRequest mutation = copyRequest(searchRequest);
599608
List<CheckedRunnable<IOException>> mutators = new ArrayList<>();

x-pack/plugin/async-search/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
2+
13
apply plugin: 'elasticsearch.internal-es-plugin'
24
apply plugin: 'elasticsearch.internal-cluster-test'
35
apply plugin: 'elasticsearch.internal-java-rest-test'
@@ -34,3 +36,8 @@ restResources {
3436
include '_common', 'indices', 'index', 'async_search'
3537
}
3638
}
39+
40+
tasks.withType(StandaloneRestIntegTestTask).configureEach {
41+
def isSnapshot = buildParams.snapshotBuild
42+
it.onlyIf("snapshot build") { isSnapshot }
43+
}

0 commit comments

Comments
 (0)