Skip to content

Commit 882d51a

Browse files
committed
do not set indices when none are returned
1 parent 8b35839 commit 882d51a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

graylog-storage-opensearch3/src/main/java/org/graylog/storage/opensearch3/views/OpenSearchBackend.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,14 @@ public QueryResult doRun(SearchJob job, Query query, OSGeneratedQueryContext que
298298
})
299299
.orElse(affectedIndices);
300300

301-
Set<String> indices = affectedIndicesForSearchType.isEmpty() ? Collections.singleton("*") : affectedIndicesForSearchType;
302-
final MutableSearchRequestBuilder searchRequest = searchTypeQueries.get(searchTypeId)
301+
MutableSearchRequestBuilder searchRequest = searchTypeQueries.get(searchTypeId)
303302
.copy()
304-
.index(indices.stream().toList())
305303
.allowNoIndices(true)
306304
.ignoreUnavailable(true)
307305
.expandWildcards(ExpandWildcard.Open);
306+
if (affectedIndices != null && !affectedIndicesForSearchType.isEmpty()) {
307+
searchRequest.index(affectedIndicesForSearchType.stream().toList());
308+
}
308309

309310
if (!SearchJob.NO_CANCELLATION.equals(job.getCancelAfterSeconds())) {
310311
searchRequest.cancelAfterTimeInterval(Time.of(t -> t.time(job.getCancelAfterSeconds() + "s")));

0 commit comments

Comments
 (0)