001/* 002 * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * tdelprat 018 * bdelbosc 019 */ 020 021package org.nuxeo.elasticsearch.api; 022 023import org.elasticsearch.index.query.QueryBuilder; 024import org.nuxeo.ecm.core.api.CoreSession; 025import org.nuxeo.ecm.core.api.DocumentModelList; 026import org.nuxeo.ecm.core.api.SortInfo; 027import org.nuxeo.elasticsearch.query.NxQueryBuilder; 028 029/** 030 * Interface to search on documents 031 * 032 * @since 5.9.3 033 */ 034public interface ElasticSearchService { 035 036 /** 037 * Returns a document list using an {@link NxQueryBuilder}. 038 * 039 * @since 5.9.5 040 */ 041 DocumentModelList query(NxQueryBuilder queryBuilder); 042 043 /** 044 * Returns documents and aggregates. 045 * 046 * @since 6.0 047 */ 048 EsResult queryAndAggregate(NxQueryBuilder queryBuilder); 049 050 /** 051 * Returns a document list using an NXQL query. Fetch documents from the VCS repository. 052 * 053 * @since 5.9.3 054 * @deprecated since 6.0, use query with NxQueryBuilder 055 */ 056 @Deprecated 057 DocumentModelList query(CoreSession session, String nxql, int limit, int offset, SortInfo... sortInfos); 058 059 /** 060 * Returns a document list using an ElasticSearch {@link QueryBuilder}. Fetch documents from the VCS repository. 061 * 062 * @since 5.9.3 063 * @deprecated since 6.0, use query with NxQueryBuilder 064 */ 065 @Deprecated 066 DocumentModelList query(CoreSession session, QueryBuilder queryBuilder, int limit, int offset, 067 SortInfo... sortInfos); 068 069}