code: public static void sendDocument(String json, CloseableHttpClient httpClient, String url) throws IOException {
          final HttpPut httpPut = new HttpPut(url);
          httpPut.addHeader("Content-Type", NanoHTTPD.MIME_JSON);
          httpPut.setEntity(new StringEntity(
                  json, ContentType.APPLICATION_JSON));
  
          try (CloseableHttpResponse response = httpClient.execute(httpPut)) {
              HttpEntity entity = HttpClientWrapper.checkAndFetch(response, url);
  
              try {
                  log.info("Had result when sending document to Elasticsearch at " + url + ": " + IOUtils.toString(entity.getContent(), "UTF-8"));
              } finally {
                  // ensure all content is taken out to free resources
                  EntityUtils.consume(entity);
              }
          }
      }
docs: Send the given document to the given Elasticsearch URL/Index
  
  Authentication can be provided via the configured {@link HttpClient} instance.
  
  @param json The json-string to store as document
  @param httpClient The HTTP Client that can be used to send metrics.
  This can also contain credentials for basic authentication if necessary
  @param url The base URL where Elasticsearch is available.
  
  @throws IOException If the HTTP call fails with an HTTP status code.