private Engine.IndexResult index(Engine engine, Engine.Index index) throws IOException { active.set(true); final Engine.IndexResult result; index = indexingOperationListeners.preIndex(shardId, index); try { if (logger.isTraceEnabled()) { // don't use index.source().utf8ToString() here source might not be valid UTF-8 logger.trace("index [{}][{}] (seq# [{}])", index.type(), index.id(), index.seqNo()); } result = engine.index(index); } catch (Exception e) { indexingOperationListeners.postIndex(shardId, index, e); throw e; } indexingOperationListeners.postIndex(shardId, index, result); return result; }
protected void index(Engine engine, Engine.Index engineIndex) throws IOException { engine.index(engineIndex); }
public void doIndex(final Index index) throws EngineException { if (position < filters.length) { final EngineFilter filter = filters[position]; position++; filter.doIndex(index, this); } else { engine.index(index); } }
public Engine.IndexResult index(Engine engine, Engine.Index index) throws IOException { active.set(true); final Engine.IndexResult result; index = indexingOperationListeners.preIndex(shardId, index); try { if (logger.isTraceEnabled()) { logger.trace("index [{}][{}] (v# [{}])", index.type(), index.id(), index.version()); } result = engine.index(index); } catch (Exception e) { indexingOperationListeners.postIndex(shardId, index, e); throw e; } indexingOperationListeners.postIndex(shardId, index, result); return result; }
private Engine.IndexResult index(Engine engine, Engine.Index index) throws IOException { active.set(true); final Engine.IndexResult result; index = indexingOperationListeners.preIndex(shardId, index); try { if (logger.isTraceEnabled()) { // don't use index.source().utf8ToString() here source might not be valid UTF-8 logger.trace("index [{}][{}] (seq# [{}])", index.type(), index.id(), index.seqNo()); } result = engine.index(index); } catch (Exception e) { indexingOperationListeners.postIndex(shardId, index, e); throw e; } indexingOperationListeners.postIndex(shardId, index, result); return result; }
private void applyOperation(Engine engine, Engine.Operation operation) throws IOException { switch (operation.operationType()) { case INDEX: Engine.Index engineIndex = (Engine.Index) operation; Mapping update = engineIndex.parsedDoc().dynamicMappingsUpdate(); if (engineIndex.parsedDoc().dynamicMappingsUpdate() != null) { recoveredTypes.compute(engineIndex.type(), (k, mapping) -> mapping == null ? update : mapping.merge(update, false)); } engine.index(engineIndex); break; case DELETE: engine.delete((Engine.Delete) operation); break; case NO_OP: engine.noOp((Engine.NoOp) operation); break; default: throw new IllegalStateException("No operation defined for [" + operation + "]"); } }
/** * Index a document and return whether it was created, as opposed to just * updated. */ public boolean index(Engine.Index index) { ensureWriteAllowed(index); markLastWrite(); index = indexingService.preIndex(index); final boolean created; try { if (logger.isTraceEnabled()) { logger.trace("index [{}][{}]{}", index.type(), index.id(), index.docs()); } created = engine().index(index); index.endTime(System.nanoTime()); } catch (Throwable ex) { indexingService.postIndex(index, ex); throw ex; } indexingService.postIndex(index, created); return created; }
logger.trace("[translog] recover [index] op of [{}][{}]", index.type(), index.id()); engine.index(engineIndex); break; case DELETE: