java.io.Closeable
, java.lang.AutoCloseable
public final class ElasticsearchDirectoryReader
extends org.apache.lucene.index.FilterDirectoryReader
FilterDirectoryReader
that exposes
Elasticsearch internal per shard / index information like the shard ID.Modifier and Type | Method | Description |
---|---|---|
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.
|
protected org.apache.lucene.index.DirectoryReader |
doWrapDirectoryReader(org.apache.lucene.index.DirectoryReader in) |
|
static ElasticsearchDirectoryReader |
getElasticsearchDirectoryReader(org.apache.lucene.index.DirectoryReader reader) |
Tries to unwrap the given reader until the first
ElasticsearchDirectoryReader instance is found or null if no instance is found; |
org.apache.lucene.index.IndexReader.CacheHelper |
getReaderCacheHelper() |
|
ShardId |
shardId() |
Returns the shard id this index belongs to.
|
static ElasticsearchDirectoryReader |
wrap(org.apache.lucene.index.DirectoryReader reader,
ShardId shardId) |
Wraps the given reader in a
ElasticsearchDirectoryReader as
well as all it's sub-readers in ElasticsearchLeafReader to
expose the given shard Id. |
docFreq, document, getDocCount, getSequentialSubReaders, getSumDocFreq, getSumTotalTermFreq, getTermVectors, maxDoc, numDocs, readerBase, readerIndex, totalTermFreq
directory, indexExists, listCommits, open, open, open, open, openIfChanged, openIfChanged, openIfChanged, openIfChanged
doClose, doOpenIfChanged, doOpenIfChanged, doOpenIfChanged, getDelegate, getIndexCommit, getVersion, isCurrent, unwrap
public ShardId shardId()
public org.apache.lucene.index.IndexReader.CacheHelper getReaderCacheHelper()
getReaderCacheHelper
in class org.apache.lucene.index.IndexReader
protected org.apache.lucene.index.DirectoryReader doWrapDirectoryReader(org.apache.lucene.index.DirectoryReader in) throws java.io.IOException
doWrapDirectoryReader
in class org.apache.lucene.index.FilterDirectoryReader
java.io.IOException
public static ElasticsearchDirectoryReader wrap(org.apache.lucene.index.DirectoryReader reader, ShardId shardId) throws java.io.IOException
ElasticsearchDirectoryReader
as
well as all it's sub-readers in ElasticsearchLeafReader
to
expose the given shard Id.reader
- the reader to wrapshardId
- the shard ID to expose via the elasticsearch internal reader wrappers.java.io.IOException
public static void addReaderCloseListener(org.apache.lucene.index.DirectoryReader reader, org.apache.lucene.index.IndexReader.ClosedListener listener)
ElasticsearchDirectoryReader
in it's hierarchy
otherwise we can't safely install the listener.java.lang.IllegalArgumentException
- if the reader doesn't contain an ElasticsearchDirectoryReader
in it's hierarchypublic static ElasticsearchDirectoryReader getElasticsearchDirectoryReader(org.apache.lucene.index.DirectoryReader reader)
ElasticsearchDirectoryReader
instance is found or null
if no instance is found;