use of org.springframework.data.elasticsearch.core.query.CriteriaQuery in project spring-data-elasticsearch by spring-projects.
the class GeoJsonIntegrationTests method shouldFindWithinObjectsWithCriteriaQuery.
// DATAES-931
@Test
@DisplayName("should find within objects with Criteria query")
void shouldFindWithinObjectsWithCriteriaQuery() {
CriteriaQuery query = new CriteriaQuery(new Criteria("area").within(geoShape5To35));
SearchHits<Area> searchHits = operations.search(query, Area.class);
assertThat(searchHits.getTotalHits()).isEqualTo(1L);
assertThat(searchHits.getSearchHit(0).getId()).isEqualTo("area10To20");
}
use of org.springframework.data.elasticsearch.core.query.CriteriaQuery in project spring-data-elasticsearch by spring-projects.
the class GeoJsonIntegrationTests method shouldFindContainsObjectsWithCriteriaQuery.
// DATAES-931
@Test
@DisplayName("should find contains objects with Criteria query")
void shouldFindContainsObjectsWithCriteriaQuery() {
CriteriaQuery query = new CriteriaQuery(new Criteria("area").contains(geoShape32To37));
SearchHits<Area> searchHits = operations.search(query, Area.class);
assertThat(searchHits.getTotalHits()).isEqualTo(1L);
assertThat(searchHits.getSearchHit(0).getId()).isEqualTo("area30To40");
}
use of org.springframework.data.elasticsearch.core.query.CriteriaQuery in project spring-advanced-training by arnosthavelka.
the class CityService method search.
public SearchHits<City> search(String name, String country, String subcountry, Pageable pageable) {
var index = IndexCoordinates.of(City.INDEX);
CriteriaQuery query = buildSearchQuery(name, country, subcountry);
query.setPageable(pageable);
return esTemplate.search(query, City.class, index);
}
Aggregations