IndexReader reader = DirectoryReader.open(writer, false);
IndexSearcher searcher = new IndexSearcher(reader);
BitsetFilterCache cache = new BitsetFilterCache(new Index("test"), ImmutableSettings.EMPTY);
BitDocIdSetFilter filter = cache.getBitDocIdSetFilter(new TermFilter(new Term("field", "value")));
TopDocs docs = searcher.search(new ConstantScoreQuery(filter), 1);
assertThat(docs.totalHits, equalTo(3));
// now cached
docs = searcher.search(new ConstantScoreQuery(filter), 1);