use of org.springframework.data.elasticsearch.repository.query.ElasticsearchQueryMethod in project spring-data-elasticsearch by spring-projects.
the class ElasticsearchPartQueryTests method getQueryBuilder.
private String getQueryBuilder(String methodName, Class<?>[] parameterClasses, Object[] parameters) throws NoSuchMethodException {
Method method = SampleRepository.class.getMethod(methodName, parameterClasses);
ElasticsearchQueryMethod queryMethod = new ElasticsearchQueryMethod(method, new DefaultRepositoryMetadata(SampleRepository.class), new SpelAwareProxyProjectionFactory(), converter.getMappingContext());
ElasticsearchPartQuery partQuery = new ElasticsearchPartQuery(queryMethod, operations);
CriteriaQuery criteriaQuery = partQuery.createQuery(new ParametersParameterAccessor(queryMethod.getParameters(), parameters));
SearchSourceBuilder source = new RequestFactory(converter).searchRequest(criteriaQuery, Book.class, IndexCoordinates.of("dummy")).source();
return source.toString();
}
Aggregations