code: public int reindex(String sourceIndex, String sourceType, String targetIndex) throws IOException {
          logger.debug("reindex [{}]/[{}] -> [{}]/[doc]", sourceIndex, sourceType, targetIndex);
  
          String reindexQuery = "{  \"source\": {\n" +
                  "    \"index\": \"" + sourceIndex + "\",\n" +
                  "    \"type\": \"" + sourceType + "\"\n" +
                  "  },\n" +
                  "  \"dest\": {\n" +
                  "    \"index\": \"" + targetIndex + "\",\n" +
                  "    \"type\": \"doc\"\n" +
                  "  }\n" +
                  "}\n";
  
          logger.trace("{}", reindexQuery);
  
          Request request = new Request("POST", "/_reindex");
          request.setJsonEntity(reindexQuery);
  
          Response restResponse = client.getLowLevelClient().performRequest(request);
          Map<String, Object> response = asMap(restResponse);
          logger.debug("reindex response: {}", response);
  
          return (int) response.get("total");
      }
docs: Reindex data from one index/type to another index
  @param sourceIndex source index name
  @param sourceType source type name
  @param targetIndex target index name
  @return The number of documents that have been reindexed
  @throws IOException In case of error