如何在 ES 6.4 中使用新的 Java Api 重新索引?

How to Reindex with new Java Api in ES 6.4?

存在使用 TransportClient 重新索引的旧方法,但由于它将在 ES7 中弃用,使用 RestHighLevelClient 重新索引的新方法是什么?

BulkByScrollResponse response = ReindexAction.INSTANCE.newRequestBuilder(client)
    .destination("target_index")
    .filter(QueryBuilders.matchQuery("category", "xzy")) 
    .get();

根据文档,这将在下一个次要版本中可用 (https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.5/java-rest-high-document-reindex.html)

也许您应该向集群发出一个 http 重建索引请求:https://www.elastic.co/guide/en/elasticsearch/reference/6.4/docs-reindex.html