Skip to content

Commit d5015c1

Browse files
authored
IntervalQueryBuilderTests#testNonIndexedFields test fix (#40418)
This test checks that interval queries constructed against a field with no indexed positions will throw exceptions. It uses a randomly-build IntervalsSourceProvider against a fixed set of fields; however, the random source builder can occasionally provide a source with a fixed field, meaning that even if the top-level query asks for a set of intervals over a non-indexed field, the source will delegate to another field, and no exception will be thrown. This commit changes the test to always use a simple Match provider.
1 parent 68b94ba commit d5015c1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public void testCombineDisjunctionInterval() throws IOException {
294294
}
295295

296296
public void testNonIndexedFields() throws IOException {
297-
IntervalsSourceProvider provider = createRandomSource();
297+
IntervalsSourceProvider provider = new IntervalsSourceProvider.Match("test", 0, true, null, null, null);
298298
IntervalQueryBuilder b = new IntervalQueryBuilder("no_such_field", provider);
299299
assertThat(b.toQuery(createShardContext()), equalTo(new MatchNoDocsQuery()));
300300

0 commit comments

Comments
 (0)