Skip to content

Instantly share code, notes, and snippets.

@redcho
Last active January 7, 2019 21:38
Show Gist options
  • Save redcho/609ffc4016edcf02216406b2d822b5a5 to your computer and use it in GitHub Desktop.
Save redcho/609ffc4016edcf02216406b2d822b5a5 to your computer and use it in GitHub Desktop.
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
public class Main {
public static void main(String[] args) throws IOException {
String luceneIndexPath = "my-elasticsearch/data/nodes/0/indices/eCCAJ-x6SOuN6w7vqr4tGQ/0/index";
Directory index = FSDirectory.open(Paths.get(luceneIndexPath));
IndexReader reader = DirectoryReader.open(index);
System.out.println(reader.maxDoc());
reader.close();
index.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment