File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
test/framework/src/main/java/org/elasticsearch/test Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -948,10 +948,12 @@ public boolean isTextField(String fieldName) {
948948 */
949949 public void testCacheability () throws IOException {
950950 QB queryBuilder = createTestQueryBuilder ();
951- SearchExecutionContext context = createSearchExecutionContext ();
952- QueryBuilder rewriteQuery = rewriteQuery (queryBuilder , createQueryRewriteContext (), new SearchExecutionContext (context ));
953- assertNotNull (rewriteQuery .toQuery (context ));
954- assertTrue ("query should be cacheable: " + queryBuilder .toString (), context .isCacheable ());
951+ try (IndexReaderManager irm = getIndexReaderManager ()) {
952+ SearchExecutionContext context = createSearchExecutionContext (irm .getIndexSearcher ());
953+ QueryBuilder rewriteQuery = rewriteQuery (queryBuilder , createQueryRewriteContext (), new SearchExecutionContext (context ));
954+ assertNotNull (rewriteQuery .toQuery (context ));
955+ assertTrue ("query should be cacheable: " + queryBuilder .toString (), context .isCacheable ());
956+ }
955957 }
956958
957959 public static class IndexReaderManager implements Closeable {
You can’t perform that action at this time.
0 commit comments