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 org.elasticsearch.index.query.QueryBuilder; 022import org.nuxeo.ecm.core.api.CoreSession; 023import org.nuxeo.ecm.core.api.DocumentModelList; 024import org.nuxeo.ecm.core.api.SortInfo; 025import org.nuxeo.elasticsearch.query.NxQueryBuilder; 026 027/** 028 * Interface to search on documents 029 * 030 * @since 5.9.3 031 */ 032public interface ElasticSearchService { 033 034 /** 035 * Returns a document list using an {@link NxQueryBuilder}. 036 * 037 * @since 5.9.5 038 */ 039 DocumentModelList query(NxQueryBuilder queryBuilder); 040 041 /** 042 * Returns documents and aggregates. 043 * 044 * @since 6.0 045 */ 046 EsResult queryAndAggregate(NxQueryBuilder queryBuilder); 047 048 /** 049 * Returns a document list using an NXQL query. Fetch documents from the VCS repository. 050 * 051 * @since 5.9.3 052 * @deprecated since 6.0, use query with NxQueryBuilder 053 */ 054 @Deprecated 055 DocumentModelList query(CoreSession session, String nxql, int limit, int offset, SortInfo... sortInfos); 056 057 /** 058 * Returns a document list using an ElasticSearch {@link QueryBuilder}. Fetch documents from the VCS repository. 059 * 060 * @since 5.9.3 061 * @deprecated since 6.0, use query with NxQueryBuilder 062 */ 063 @Deprecated 064 DocumentModelList query(CoreSession session, QueryBuilder queryBuilder, int limit, int offset, 065 SortInfo... sortInfos); 066 067}