Class ElasticsearchDirectoryReader
java.lang.Object
org.apache.lucene.index.IndexReader
org.apache.lucene.index.CompositeReader
org.apache.lucene.index.BaseCompositeReader<org.apache.lucene.index.LeafReader>
org.apache.lucene.index.DirectoryReader
org.apache.lucene.index.FilterDirectoryReader
org.elasticsearch.common.lucene.index.ElasticsearchDirectoryReader
- All Implemented Interfaces:
 Closeable,AutoCloseable
public final class ElasticsearchDirectoryReader
extends org.apache.lucene.index.FilterDirectoryReader
A 
FilterDirectoryReader that exposes
 Elasticsearch internal per shard / index information like the shard ID.- 
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader
org.apache.lucene.index.IndexReader.CacheHelper, org.apache.lucene.index.IndexReader.CacheKey, org.apache.lucene.index.IndexReader.ClosedListener - 
Field Summary
Fields inherited from class org.apache.lucene.index.FilterDirectoryReader
inFields inherited from class org.apache.lucene.index.DirectoryReader
directoryFields inherited from class org.apache.lucene.index.BaseCompositeReader
subReadersSorter - 
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddReaderCloseListener(org.apache.lucene.index.DirectoryReader reader, org.apache.lucene.index.IndexReader.ClosedListener listener)Adds the given listener to the provided directory reader.protected org.apache.lucene.index.DirectoryReaderdoWrapDirectoryReader(org.apache.lucene.index.DirectoryReader in)static ElasticsearchDirectoryReadergetElasticsearchDirectoryReader(org.apache.lucene.index.DirectoryReader reader)Tries to unwrap the given reader until the firstElasticsearchDirectoryReaderinstance is found ornullif no instance is found.org.apache.lucene.index.IndexReader.CacheHelpershardId()Returns the shard id this index belongs to.static ElasticsearchDirectoryReaderWraps the given reader in aElasticsearchDirectoryReaderas well as all it's sub-readers inElasticsearchLeafReaderto expose the given shard Id.Methods inherited from class org.apache.lucene.index.FilterDirectoryReader
doClose, doOpenIfChanged, doOpenIfChanged, doOpenIfChanged, getDelegate, getIndexCommit, getVersion, isCurrent, unwrapMethods inherited from class org.apache.lucene.index.DirectoryReader
directory, indexExists, listCommits, open, open, open, open, open, openIfChanged, openIfChanged, openIfChanged, openIfChangedMethods inherited from class org.apache.lucene.index.BaseCompositeReader
docFreq, document, getDocCount, getSequentialSubReaders, getSumDocFreq, getSumTotalTermFreq, getTermVectors, maxDoc, numDocs, readerBase, readerIndex, totalTermFreqMethods inherited from class org.apache.lucene.index.CompositeReader
getContext, toStringMethods inherited from class org.apache.lucene.index.IndexReader
close, decRef, document, document, ensureOpen, equals, getRefCount, getTermVector, hasDeletions, hashCode, incRef, leaves, numDeletedDocs, registerParentReader, tryIncRef 
- 
Method Details
- 
shardId
Returns the shard id this index belongs to. - 
getReaderCacheHelper
public org.apache.lucene.index.IndexReader.CacheHelper getReaderCacheHelper()- Specified by:
 getReaderCacheHelperin classorg.apache.lucene.index.IndexReader
 - 
doWrapDirectoryReader
protected org.apache.lucene.index.DirectoryReader doWrapDirectoryReader(org.apache.lucene.index.DirectoryReader in) throws IOException- Specified by:
 doWrapDirectoryReaderin classorg.apache.lucene.index.FilterDirectoryReader- Throws:
 IOException
 - 
wrap
public static ElasticsearchDirectoryReader wrap(org.apache.lucene.index.DirectoryReader reader, ShardId shardId) throws IOExceptionWraps the given reader in aElasticsearchDirectoryReaderas well as all it's sub-readers inElasticsearchLeafReaderto expose the given shard Id.- Parameters:
 reader- the reader to wrapshardId- the shard ID to expose via the elasticsearch internal reader wrappers.- Throws:
 IOException
 - 
addReaderCloseListener
public static void addReaderCloseListener(org.apache.lucene.index.DirectoryReader reader, org.apache.lucene.index.IndexReader.ClosedListener listener)Adds the given listener to the provided directory reader. The reader must contain anElasticsearchDirectoryReaderin it's hierarchy otherwise we can't safely install the listener.- Throws:
 IllegalArgumentException- if the reader doesn't contain anElasticsearchDirectoryReaderin it's hierarchy
 - 
getElasticsearchDirectoryReader
public static ElasticsearchDirectoryReader getElasticsearchDirectoryReader(org.apache.lucene.index.DirectoryReader reader)Tries to unwrap the given reader until the firstElasticsearchDirectoryReaderinstance is found ornullif no instance is found. 
 -