Search in sources :

Example 1 with DocumentReconstructor

use of org.xbib.elasticsearch.skywalker.reconstruct.DocumentReconstructor in project elasticsearch-skywalker by jprante.

the class TransportReconstructAction method shardOperation.

@Override
protected ShardReconstructIndexResponse shardOperation(ShardReconstructIndexRequest request) throws ElasticsearchException {
    IndexService indexService = indicesService.indexService(request.index());
    InternalIndexShard indexShard = (InternalIndexShard) indexService.shardSafe(request.shardId());
    Engine.Searcher searcher = indexShard.engine().acquireSearcher("transport_reconstruct");
    IndexReader reader = searcher.reader();
    DocumentReconstructor dr = new DocumentReconstructor(reader);
    try {
        return new ShardReconstructIndexResponse(true, dr.reconstruct(request.shardId()));
    } catch (IOException e) {
        throw new ElasticsearchException("failed to reconstruct index", e);
    }
}
Also used : IndexService(org.elasticsearch.index.service.IndexService) IndexReader(org.apache.lucene.index.IndexReader) DocumentReconstructor(org.xbib.elasticsearch.skywalker.reconstruct.DocumentReconstructor) IOException(java.io.IOException) ElasticsearchException(org.elasticsearch.ElasticsearchException) InternalIndexShard(org.elasticsearch.index.shard.service.InternalIndexShard) Engine(org.elasticsearch.index.engine.Engine)

Aggregations

IOException (java.io.IOException)1 IndexReader (org.apache.lucene.index.IndexReader)1 ElasticsearchException (org.elasticsearch.ElasticsearchException)1 Engine (org.elasticsearch.index.engine.Engine)1 IndexService (org.elasticsearch.index.service.IndexService)1 InternalIndexShard (org.elasticsearch.index.shard.service.InternalIndexShard)1 DocumentReconstructor (org.xbib.elasticsearch.skywalker.reconstruct.DocumentReconstructor)1