private ElasticsearchQuery doCreateEsQuery( final Query query, final SearchRequest searchRequest, final QueryBuilder queryWithFilters) { final StorageSettings settings = searchRequest.getSettings(); final ElasticsearchQuery.Builder queryBuilder = ElasticsearchQuery.create() .index(settings.getStorageName().getName()) .indexType(settings.getStorageType().getName()) .query(queryWithFilters) .setAggregations(aggregationsBuilder.create(query.getAggregationQueries())) .sortBuilders(sortBuilder.create(query.getOrderBys())) .filter(filterBuilderFactory.create(query.getPostFilters())) .setReturnFields(searchRequest.getReturnFields()) .searchType(SearchType.valueOf(searchRequest.getSearchType().toString())) .from(query.getFrom()) .size(query.getSize()); return queryBuilder.build(); }
private ElasticsearchQuery translateQuery(final SearchRequest searchRequest) { final Query query = searchRequest.getQuery(); if (query instanceof NodeQuery) { return nodeQueryTranslator.translate(searchRequest); } if (query instanceof NodeVersionQuery) { return nodeVersionQueryTranslator.translate(searchRequest); } if (query instanceof NodeVersionDiffQuery) { return nodeVersionDiffQueryTranslator.translate(searchRequest); } if (query instanceof NodeBranchQuery) { return nodeBranchQueryTranslator.translate(searchRequest); } throw new UnsupportedOperationException( "Queries of type " + query.getClass() + " not implemented yes"); }