RemoteElasticsearchClient implements ElasticsearchClient { @Override public Single<Boolean> putMapping(String type, JsonObject mapping) { String uri = "/" + index + "/_mapping/" + type + "?include_type_name=true"; return client.performRequest(HttpMethod.PUT, uri, mapping.toBuffer()) .map(res -> res.getBoolean("acknowledged", true)); } 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 putMapping(TestContext context) { wireMockRule1.stubFor(put(urlEqualTo("/" + INDEX + "/_mapping/" + TYPE + "?include_type_name=true")) .willReturn(aResponse() .withStatus(200) .withBody(ACKNOWLEDGED.encode()))); JsonObject mappings = new JsonObject() .put("properties", new JsonObject() .put("name", new JsonObject() .put("type", "text"))); Async async = context.async(); client.putMapping(TYPE, mappings).subscribe(ack -> { wireMockRule1.verify(putRequestedFor(urlEqualTo("/" + INDEX + "/_mapping/" + TYPE + "?include_type_name=true")) .withRequestBody(equalToJson("{\"properties\":{\"name\":{\"type\":\"text\"}}}}}"))); context.assertTrue(ack); async.complete(); }, context::fail); }