Skip to content

Commit 96fb75e

Browse files
committed
Merge remote-tracking branch 'upstream/main' into unmapped-fields-special-field-visitor-2
2 parents 3ab1905 + 7d2de6b commit 96fb75e

File tree

8 files changed

+27
-13
lines changed

8 files changed

+27
-13
lines changed

docs/changelog/132408.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 132408
2+
summary: Correct exception for missing nested path
3+
area: Search
4+
type: bug
5+
issues: []

docs/changelog/132414.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 132414
2+
summary: Adjust date docvalue formatting to return 4xx instead of 5xx
3+
area: Search
4+
type: bug
5+
issues: []

muted-tests.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -482,12 +482,6 @@ tests:
482482
- class: org.elasticsearch.xpack.remotecluster.CrossClusterEsqlRCS1EnrichUnavailableRemotesIT
483483
method: testEsqlEnrichWithSkipUnavailable
484484
issue: https://github.com/elastic/elasticsearch/issues/132078
485-
- class: org.elasticsearch.test.rest.ClientYamlTestSuiteIT
486-
method: test {yaml=update/100_synthetic_source/stored text}
487-
issue: https://github.com/elastic/elasticsearch/issues/132108
488-
- class: org.elasticsearch.test.rest.ClientYamlTestSuiteIT
489-
method: test {yaml=update/100_synthetic_source/keyword}
490-
issue: https://github.com/elastic/elasticsearch/issues/132110
491485
- class: org.elasticsearch.index.engine.MergeWithLowDiskSpaceIT
492486
method: testRelocationWhileForceMerging
493487
issue: https://github.com/elastic/elasticsearch/issues/131789

rest-api-spec/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,6 @@ tasks.named("yamlRestCompatTestTransform").configure ({ task ->
9090
task.skipTest("indices.create/21_synthetic_source_stored/field param - keep root array", "Synthetic source keep arrays now stores leaf arrays natively")
9191
task.skipTest("cluster.info/30_info_thread_pool/Cluster HTTP Info", "The search_throttled thread pool has been removed")
9292
task.skipTest("synonyms/80_synonyms_from_index/Fail loading synonyms from index if synonyms_set doesn't exist", "Synonyms do no longer fail if the synonyms_set doesn't exist")
93+
task.skipTest("update/100_synthetic_source/keyword", "synthetic recovery source means _recovery_source field will not be present")
94+
task.skipTest("update/100_synthetic_source/stored text", "synthetic recovery source means _recovery_source field will not be present")
9395
})

server/src/main/java/org/elasticsearch/index/query/NestedQueryBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public static <E extends Exception> Query toQuery(
300300
if (ignoreUnmapped) {
301301
return new MatchNoDocsQuery();
302302
} else {
303-
throw new IllegalStateException("[" + NAME + "] failed to find nested object under path [" + path + "]");
303+
throw new QueryShardException(context, "[" + NAME + "] failed to find nested object under path [" + path + "]");
304304
}
305305
}
306306
final BitSetProducer parentFilter;

server/src/main/java/org/elasticsearch/search/DocValueFormat.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.text.DecimalFormatSymbols;
3535
import java.text.NumberFormat;
3636
import java.text.ParseException;
37+
import java.time.DateTimeException;
3738
import java.time.ZoneId;
3839
import java.util.Arrays;
3940
import java.util.Base64;
@@ -304,7 +305,14 @@ public DateMathParser getDateMathParser() {
304305

305306
@Override
306307
public String format(long value) {
307-
return formatter.format(resolution.toInstant(value).atZone(timeZone));
308+
try {
309+
return formatter.format(resolution.toInstant(value).atZone(timeZone));
310+
} catch (DateTimeException dte) {
311+
throw new IllegalArgumentException(
312+
"Failed formatting value [" + value + "] as date with pattern [" + formatter.pattern() + "]",
313+
dte
314+
);
315+
}
308316
}
309317

310318
@Override

server/src/test/java/org/elasticsearch/index/query/NestedQueryBuilderTests.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,7 @@ public void testIgnoreUnmapped() throws IOException {
294294

295295
final NestedQueryBuilder failingQueryBuilder = new NestedQueryBuilder("unmapped", new MatchAllQueryBuilder(), ScoreMode.None);
296296
failingQueryBuilder.ignoreUnmapped(false);
297-
IllegalStateException e = expectThrows(
298-
IllegalStateException.class,
299-
() -> failingQueryBuilder.toQuery(createSearchExecutionContext())
300-
);
297+
QueryShardException e = expectThrows(QueryShardException.class, () -> failingQueryBuilder.toQuery(createSearchExecutionContext()));
301298
assertThat(e.getMessage(), containsString("[" + NestedQueryBuilder.NAME + "] failed to find nested object under path [unmapped]"));
302299
}
303300

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/AnalyzerTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@
123123
import static org.elasticsearch.xpack.esql.analysis.AnalyzerTestUtils.indexWithDateDateNanosUnionType;
124124
import static org.elasticsearch.xpack.esql.analysis.AnalyzerTestUtils.loadMapping;
125125
import static org.elasticsearch.xpack.esql.analysis.AnalyzerTestUtils.tsdbIndexResolution;
126+
import static org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin.DENSE_VECTOR_FEATURE_FLAG;
126127
import static org.elasticsearch.xpack.esql.core.tree.Source.EMPTY;
127128
import static org.elasticsearch.xpack.esql.core.type.DataType.DATETIME;
128129
import static org.elasticsearch.xpack.esql.core.type.DataType.DATE_NANOS;
@@ -3755,7 +3756,9 @@ public void testRerankInvalidQueryTypes() {
37553756
}
37563757

37573758
public void testRerankFieldsInvalidTypes() {
3758-
List<String> invalidFieldNames = List.of("date", "date_nanos", "ip", "version", "dense_vector");
3759+
List<String> invalidFieldNames = DENSE_VECTOR_FEATURE_FLAG.isEnabled()
3760+
? List.of("date", "date_nanos", "ip", "version", "dense_vector")
3761+
: List.of("date", "date_nanos", "ip", "version");
37593762

37603763
for (String fieldName : invalidFieldNames) {
37613764
LogManager.getLogger(AnalyzerTests.class).warn("[{}]", fieldName);

0 commit comments

Comments
 (0)