private void work() throws Exception { System.out.println("Indexing all events..."); for (Event event : eventDao.getEvents()) { indexEvent(event); } SearchService.IndexStatistics statistics = searchService.getIndexStatistics(); System.out.println("The index now contain " + statistics.numberOfDocuments + " documents."); }