org.elasticsearch.index.deletionpolicy
Class KeepOnlyLastDeletionPolicy

java.lang.Object
  extended by org.elasticsearch.index.shard.AbstractIndexShardComponent
      extended by org.elasticsearch.index.deletionpolicy.KeepOnlyLastDeletionPolicy
All Implemented Interfaces:
org.apache.lucene.index.IndexDeletionPolicy, IndexShardComponent

public class KeepOnlyLastDeletionPolicy
extends AbstractIndexShardComponent
implements org.apache.lucene.index.IndexDeletionPolicy

This IndexDeletionPolicy implementation that keeps only the most recent commit and immediately removes all prior commits after a new commit is done. This is the default deletion policy.


Field Summary
 
Fields inherited from class org.elasticsearch.index.shard.AbstractIndexShardComponent
componentSettings, indexSettings, logger, shardId
 
Constructor Summary
KeepOnlyLastDeletionPolicy(ShardId shardId, Settings indexSettings)
           
 
Method Summary
 void onCommit(java.util.List<? extends org.apache.lucene.index.IndexCommit> commits)
          Deletes all commits except the most recent one.
 void onInit(java.util.List<? extends org.apache.lucene.index.IndexCommit> commits)
          Deletes all commits except the most recent one.
 
Methods inherited from class org.elasticsearch.index.shard.AbstractIndexShardComponent
indexSettings, managementGroupName, nodeName, shardId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeepOnlyLastDeletionPolicy

@Inject
public KeepOnlyLastDeletionPolicy(ShardId shardId,
                                         @IndexSettings
                                         Settings indexSettings)
Method Detail

onInit

public void onInit(java.util.List<? extends org.apache.lucene.index.IndexCommit> commits)
Deletes all commits except the most recent one.

Specified by:
onInit in interface org.apache.lucene.index.IndexDeletionPolicy

onCommit

public void onCommit(java.util.List<? extends org.apache.lucene.index.IndexCommit> commits)
Deletes all commits except the most recent one.

Specified by:
onCommit in interface org.apache.lucene.index.IndexDeletionPolicy