Skip to content

Commit 1192271

Browse files
committed
no pruning if we do not have an indexreader
1 parent a4bb87c commit 1192271

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/search/SparseVectorQueryBuilder.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,11 @@ public TransportVersion getMinimalSupportedVersion() {
351351
}
352352

353353
private TokenPruningConfig getTokenPruningConfigForQuery(MappedFieldType ft, SearchExecutionContext context) {
354+
// if we do not have an index reader, there can be no token pruning
355+
if (context.getIndexReader() == null) {
356+
return null;
357+
}
358+
354359
// if we are not on a supported index version, do not prune by default
355360
// nor do we check the index options
356361
if (context.indexVersionCreated().onOrAfter(IndexVersions.SPARSE_VECTOR_PRUNING_INDEX_OPTIONS_SUPPORT) == false

0 commit comments

Comments
 (0)