@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 Engine.Index beforeIndex(Engine.Index index) { if (index.type().equals(index().name())) { percolator.addQuery(index.id(), index.source()); } return index; }
@Override public void postIndexUnderLock(Engine.Index index) { // add the query under a doc lock if (PercolatorService.TYPE_NAME.equals(index.type())) { addPercolateQuery(index.id(), index.source()); } }
@Override public Engine.Index preIndex(Engine.Index index) { // validate the query here, before we index if (PercolatorService.TYPE_NAME.equals(index.type())) { parsePercolatorDocument(index.id(), index.source()); } return index; }
@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, 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(); } }
public Index(Engine.Index index) { this(index.type(), index.id(), index.source()); this.routing = index.routing(); this.parent = index.parent(); this.version = index.version(); }