RemoteElasticsearchClient implements ElasticsearchClient { @Override public Single<Boolean> createIndex() { return createIndex(null); } RemoteElasticsearchClient(List<URI> hosts, String index,
      Duration autoUpdateHostsInterval, boolean compressRequestBodies, Vertx vertx); @Override void close(); @Override Single<JsonObject> bulkInsert(String type,
      List<Tuple2<String, JsonObject>> documents); @Override Single<JsonObject> beginScroll(String type, JsonObject query,
      JsonObject postFilter, JsonObject aggregations, JsonObject parameters, String timeout); @Override Single<JsonObject> continueScroll(String scrollId, String timeout); @Override Single<JsonObject> search(String type, JsonObject query,
      JsonObject postFilter, JsonObject aggregations, JsonObject parameters); @Override Single<Long> count(String type, JsonObject query); @Override Single<JsonObject> updateByQuery(String type, JsonObject postFilter,
      JsonObject script); @Override Single<JsonObject> bulkDelete(String type, JsonArray ids); @Override Single<Boolean> indexExists(); @Override Single<Boolean> typeExists(String type); @Override Single<Boolean> createIndex(); @Override Single<Boolean> createIndex(JsonObject settings); @Override Completable ensureIndex(); @Override Single<Boolean> putMapping(String type, JsonObject mapping); @Override Completable ensureMapping(String type, JsonObject mapping); @Override Single<JsonObject> getMapping(String type); @Override Single<JsonObject> getMapping(String type, String field); @Override Single<Boolean> isRunning();  }
@Test public void createIndex(TestContext context) { StubMapping settings = wireMockRule1.stubFor(put(urlEqualTo("/" + INDEX)) .willReturn(aResponse() .withBody(ACKNOWLEDGED.encode()) .withStatus(200))); Async async = context.async(); client.createIndex().subscribe(ok -> { context.assertTrue(ok); wireMockRule1.verify(putRequestedFor(settings.getRequest().getUrlMatcher())); async.complete(); }, context::fail); }
@Test public void createIndexWithSettings(TestContext context) { StubMapping settings = wireMockRule1.stubFor(put(urlEqualTo("/" + INDEX)) .withRequestBody(equalToJson(SETTINGS_WRAPPER.encode())) .willReturn(aResponse() .withBody(ACKNOWLEDGED.encode()) .withStatus(200))); Async async = context.async(); client.createIndex(SETTINGS).subscribe(ok -> { context.assertTrue(ok); wireMockRule1.verify(putRequestedFor(settings.getRequest().getUrlMatcher())); async.complete(); }, context::fail); }