Async nature of ElasticSearch Java API

elasticsearch, groovy, java

Solution

As @loteq mentioned, you can simply call `.actionGet()` on a `Future` to make it synchronous. Check elasticsearch integration tests, they have some very good examples.

Problem

Wanna write integration tests for elasticSearch service: 1. Index 2. Search 3. Check result Each Java api method is executed asynchronously. How can I make it as simple sync api: call `api.a`, waiting for result, call `api.b`, waiting for result...

Original source