use of org.springframework.data.elasticsearch.core.query.StringQuery in project spring-data-elasticsearch by spring-projects.
the class ReactiveElasticsearchStringQueryUnitTests method bindsExpressionPropertyCorrectly.
// DATAES-519
@Test
@Disabled("TODO: fix spel query integration")
public void bindsExpressionPropertyCorrectly() throws Exception {
ReactiveElasticsearchStringQuery elasticsearchStringQuery = createQueryForMethod("findByNameWithExpression", String.class);
StubParameterAccessor accessor = new StubParameterAccessor("Luke");
org.springframework.data.elasticsearch.core.query.Query query = elasticsearchStringQuery.createQuery(accessor);
StringQuery reference = new StringQuery("{ 'bool' : { 'must' : { 'term' : { 'name' : 'Luke' } } } }");
assertThat(query).isInstanceOf(StringQuery.class);
assertThat(((StringQuery) query).getSource()).isEqualTo(reference.getSource());
}
use of org.springframework.data.elasticsearch.core.query.StringQuery in project spring-data-elasticsearch by spring-projects.
the class ReactiveElasticsearchTemplateUnitTests method deleteByShouldUseDefaultRefreshPolicy.
// DATAES-504
@Test
public void deleteByShouldUseDefaultRefreshPolicy() {
ArgumentCaptor<DeleteByQueryRequest> captor = ArgumentCaptor.forClass(DeleteByQueryRequest.class);
when(client.deleteBy(captor.capture())).thenReturn(Mono.empty());
//
template.delete(new StringQuery(QueryBuilders.matchAllQuery().toString()), Object.class, index).as(//
StepVerifier::create).verifyComplete();
assertThat(captor.getValue().isRefresh()).isTrue();
}
use of org.springframework.data.elasticsearch.core.query.StringQuery in project spring-data-elasticsearch by spring-projects.
the class ReactiveElasticsearchTemplateUnitTests method deleteByShouldApplyIndicesOptions.
// DATAES-504
@Test
public void deleteByShouldApplyIndicesOptions() {
ArgumentCaptor<DeleteByQueryRequest> captor = ArgumentCaptor.forClass(DeleteByQueryRequest.class);
when(client.deleteBy(captor.capture())).thenReturn(Mono.empty());
//
template.delete(new StringQuery(QueryBuilders.matchAllQuery().toString()), Object.class, index).as(//
StepVerifier::create).verifyComplete();
assertThat(captor.getValue().indicesOptions()).isEqualTo(DEFAULT_INDICES_OPTIONS);
}
use of org.springframework.data.elasticsearch.core.query.StringQuery in project spring-data-elasticsearch by spring-projects.
the class ReactiveElasticsearchTemplateUnitTests method deleteByShouldApplyIndicesOptionsIfSet.
// DATAES-504
@Test
public void deleteByShouldApplyIndicesOptionsIfSet() {
ArgumentCaptor<DeleteByQueryRequest> captor = ArgumentCaptor.forClass(DeleteByQueryRequest.class);
when(client.deleteBy(captor.capture())).thenReturn(Mono.empty());
template.setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN);
//
template.delete(new StringQuery(QueryBuilders.matchAllQuery().toString()), Object.class, index).as(//
StepVerifier::create).verifyComplete();
assertThat(captor.getValue().indicesOptions()).isEqualTo(IndicesOptions.LENIENT_EXPAND_OPEN);
}
use of org.springframework.data.elasticsearch.core.query.StringQuery in project spring-data-elasticsearch by spring-projects.
the class ReactiveElasticsearchTemplateUnitTests method deleteByShouldApplyRefreshPolicy.
// DATAES-504
@Test
public void deleteByShouldApplyRefreshPolicy() {
ArgumentCaptor<DeleteByQueryRequest> captor = ArgumentCaptor.forClass(DeleteByQueryRequest.class);
when(client.deleteBy(captor.capture())).thenReturn(Mono.empty());
template.setRefreshPolicy(RefreshPolicy.NONE);
//
template.delete(new StringQuery(QueryBuilders.matchAllQuery().toString()), Object.class, index).as(//
StepVerifier::create).verifyComplete();
assertThat(captor.getValue().isRefresh()).isFalse();
}
Aggregations