@Override
 public Engine.Index preIndex(Engine.Index operation) {
   if (operation.origin() != Engine.Operation.Origin.RECOVERY) {
     totalStats.indexCurrent.inc();
     typeStats(operation.type()).indexCurrent.inc();
   }
   return operation;
 }
 @Override
 public void postIndex(Engine.Index index, Throwable ex) {
   if (index.origin() != Engine.Operation.Origin.RECOVERY) {
     totalStats.indexCurrent.dec();
     typeStats(index.type()).indexCurrent.dec();
     totalStats.indexFailed.inc();
     typeStats(index.type()).indexFailed.inc();
   }
 }
 @Override
 public void postIndex(Engine.Index index, boolean created) {
   if (index.origin() != Engine.Operation.Origin.RECOVERY) {
     long took = index.endTime() - index.startTime();
     totalStats.indexMetric.inc(took);
     totalStats.indexCurrent.dec();
     StatsHolder typeStats = typeStats(index.type());
     typeStats.indexMetric.inc(took);
     typeStats.indexCurrent.dec();
   }
 }