use of org.springframework.data.elasticsearch.client.reactive.ReactiveElasticsearchClient in project spring-boot by spring-projects.
the class ReactiveElasticsearchRestClientAutoConfigurationIntegrationTests method restClientCanQueryElasticsearchNode.
@Test
void restClientCanQueryElasticsearchNode() {
this.contextRunner.withPropertyValues("spring.elasticsearch.uris=" + elasticsearch.getHttpHostAddress(), "spring.elasticsearch.connection-timeout=120s", "spring.elasticsearch.socket-timeout=120s").run((context) -> {
ReactiveElasticsearchClient client = context.getBean(ReactiveElasticsearchClient.class);
Map<String, String> source = new HashMap<>();
source.put("a", "alpha");
source.put("b", "bravo");
IndexRequest indexRequest = new IndexRequest("foo").id("1").source(source);
GetRequest getRequest = new GetRequest("foo").id("1");
GetResult getResult = client.index(indexRequest).then(client.get(getRequest)).block();
assertThat(getResult).isNotNull();
assertThat(getResult.isExists()).isTrue();
});
}
use of org.springframework.data.elasticsearch.client.reactive.ReactiveElasticsearchClient in project spring-boot by spring-projects.
the class ElasticsearchReactiveHealthIndicatorTests method setup.
@BeforeEach
void setup() throws Exception {
this.server = new MockWebServer();
this.server.start();
ReactiveElasticsearchClient client = DefaultReactiveElasticsearchClient.create(ClientConfiguration.create(this.server.getHostName() + ":" + this.server.getPort()));
this.healthIndicator = new ElasticsearchReactiveHealthIndicator(client);
}
Aggregations