001/* 002 * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl-2.1.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * tdelprat 016 * bdelbosc 017 */ 018 019package org.nuxeo.elasticsearch.api; 020 021import java.util.List; 022 023import org.nuxeo.elasticsearch.commands.IndexingCommand; 024 025/** 026 * Interface to process indexing of documents 027 * 028 * @since 5.9.3 029 */ 030public interface ElasticSearchIndexing { 031 032 /** 033 * Run a worker to process the {@link IndexingCommand}. 034 * <p> 035 * Asynchronous command schedules an indexing job and return. 036 * </p> 037 * <p> 038 * Synchronous command execute an indexing job using a new Tx then refresh the index so the document is searchable 039 * immediately. if the command is also recursive the children are processed asynchronously. 040 * </p> 041 * <p> 042 * If there is more than one cmd the elasticsearch request is done in bulk mode. 043 * </p> 044 * 045 * @since 7.1 046 */ 047 void runIndexingWorker(List<IndexingCommand> cmds); 048 049 /** 050 * Reindex documents matching the NXQL query, This is done in an asynchronous job. 051 * 052 * @since 7.1 053 */ 054 void runReindexingWorker(String repositoryName, String nxql); 055 056 /** 057 * Process the {@link IndexingCommand}. 058 * <p> 059 * Send indexing command to Elasticsearch, if the command is synchronous the index is refreshed so the document is 060 * searchable immediately. Recursive indexing is not taken in account except for deletion. This is not a 061 * transactional operation, a rollback will not discard the executed commands. 062 * </p> 063 * 064 * @since 7.1 065 */ 066 void indexNonRecursive(IndexingCommand cmd); 067 068 /** 069 * Same as {@link ElasticSearchIndexing#indexNonRecursive(org.nuxeo.elasticsearch.commands.IndexingCommand)} but 070 * process the list command using a bulk request.</p> 071 * 072 * @since 7.1 073 */ 074 void indexNonRecursive(List<IndexingCommand> cmds); 075 076}