Java Code Examples for org.elasticsearch.index.shard.IndexShard#flush()
The following examples show how to use
org.elasticsearch.index.shard.IndexShard#flush() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SyncedFlushService.java From Elasticsearch with Apache License 2.0 | 5 votes |
private PreSyncedFlushResponse performPreSyncedFlush(PreShardSyncedFlushRequest request) { IndexShard indexShard = indicesService.indexServiceSafe(request.shardId().getIndex()).shardSafe(request.shardId().id()); FlushRequest flushRequest = new FlushRequest().force(false).waitIfOngoing(true); logger.trace("{} performing pre sync flush", request.shardId()); Engine.CommitId commitId = indexShard.flush(flushRequest); logger.trace("{} pre sync flush done. commit id {}", request.shardId(), commitId); return new PreSyncedFlushResponse(commitId); }
Example 2
Source File: TransportShardFlushAction.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override protected Tuple<ActionWriteResponse, ShardFlushRequest> shardOperationOnPrimary(MetaData metaData, ShardFlushRequest shardRequest) throws Throwable { IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.shardId().getIndex()).shardSafe(shardRequest.shardId().id()); indexShard.flush(shardRequest.getRequest()); logger.trace("{} flush request executed on primary", indexShard.shardId()); return new Tuple<>(new ActionWriteResponse(), shardRequest); }
Example 3
Source File: SyncedFlushService.java From crate with Apache License 2.0 | 5 votes |
private PreSyncedFlushResponse performPreSyncedFlush(PreShardSyncedFlushRequest request) { IndexShard indexShard = indicesService.indexServiceSafe(request.shardId().getIndex()).getShard(request.shardId().id()); FlushRequest flushRequest = new FlushRequest().force(false).waitIfOngoing(true); LOGGER.trace("{} performing pre sync flush", request.shardId()); indexShard.flush(flushRequest); final CommitStats commitStats = indexShard.commitStats(); final Engine.CommitId commitId = commitStats.getRawCommitId(); LOGGER.trace("{} pre sync flush done. commit id {}, num docs {}", request.shardId(), commitId, commitStats.getNumDocs()); return new PreSyncedFlushResponse(commitId, commitStats.getNumDocs(), commitStats.syncId()); }
Example 4
Source File: TransportShardFlushAction.java From Elasticsearch with Apache License 2.0 | 4 votes |
@Override protected void shardOperationOnReplica(ShardFlushRequest request) { IndexShard indexShard = indicesService.indexServiceSafe(request.shardId().getIndex()).shardSafe(request.shardId().id()); indexShard.flush(request.getRequest()); logger.trace("{} flush request executed on replica", indexShard.shardId()); }
Example 5
Source File: TransportShardFlushAction.java From crate with Apache License 2.0 | 4 votes |
@Override protected PrimaryResult shardOperationOnPrimary(ShardFlushRequest shardRequest, IndexShard primary) { primary.flush(shardRequest.getRequest()); logger.trace("{} flush request executed on primary", primary.shardId()); return new PrimaryResult<>(shardRequest, new ReplicationResponse()); }
Example 6
Source File: TransportShardFlushAction.java From crate with Apache License 2.0 | 4 votes |
@Override protected ReplicaResult shardOperationOnReplica(ShardFlushRequest request, IndexShard replica) { replica.flush(request.getRequest()); logger.trace("{} flush request executed on replica", replica.shardId()); return new ReplicaResult(); }