use of org.springframework.data.elasticsearch.core.index.DeleteTemplateRequest in project spring-data-elasticsearch by spring-projects.
the class ReactiveIndexOperationsTest method shouldDeleteTemplate.
// DATAES-612
@Test
void shouldDeleteTemplate() {
ReactiveIndexOperations indexOps = operations.indexOps(Entity.class);
String templateName = "template" + UUID.randomUUID().toString();
ExistsTemplateRequest existsTemplateRequest = new ExistsTemplateRequest(templateName);
PutTemplateRequest putTemplateRequest = //
PutTemplateRequest.builder(templateName, "log-*").withOrder(//
11).withVersion(//
42).build();
boolean acknowledged = indexOps.putTemplate(putTemplateRequest).block();
assertThat(acknowledged).isTrue();
boolean exists = indexOps.existsTemplate(existsTemplateRequest).block();
assertThat(exists).isTrue();
acknowledged = indexOps.deleteTemplate(new DeleteTemplateRequest(templateName)).block();
assertThat(acknowledged).isTrue();
exists = indexOps.existsTemplate(existsTemplateRequest).block();
assertThat(exists).isFalse();
}
use of org.springframework.data.elasticsearch.core.index.DeleteTemplateRequest in project spring-data-elasticsearch by spring-projects.
the class ReactiveIndexTemplate method deleteTemplate.
@Override
public Mono<Boolean> deleteTemplate(DeleteTemplateRequest deleteTemplateRequest) {
Assert.notNull(deleteTemplateRequest, "deleteTemplateRequest must not be null");
DeleteIndexTemplateRequest deleteIndexTemplateRequest = requestFactory.deleteIndexTemplateRequest(deleteTemplateRequest);
return Mono.from(operations.executeWithIndicesClient(client -> client.deleteTemplate(deleteIndexTemplateRequest)));
}
Aggregations