[英]Upgrade Elasticsearch transport client to Rest client?
Could anyone please help me to find corresponding API references for update these API to Rest instead of transportClient ? 任何人都可以帮助我找到相应的API参考,以将这些API更新为Rest而不是transportClient吗?
String[] indices = transportClient.admin()
.indices()
.prepareGetIndex()
.addIndices("_" + tid + "-")
.execute()
.actionGet()
.getIndices();
transportClient.admin()
.indices()
.prepareFlush(indexName)
.get();
transportClient.admin()
.indices()
.prepareRefresh(indexName)
.get();
transportClient.admin()
.cluster()
.state(clusterStateRequest)
.actionGet()
.getState()
.getMetaData()
.index(indexName)
.getAliases();
If you want to use RestHighLevelClient
, you just have to change your TransportClient
to the RestClient
like this 如果要使用
RestHighLevelClient
,则只需将TransportClient
更改为RestClient
如下所示
RestHighLevelClient client = new RestHighLevelClient(
RestClient.builder(
new HttpHost("localhost", 9200, "http"),
new HttpHost("localhost", 9201, "http")));
https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.2/java-rest-low-usage-initialization.html https://www.elastic.co/guide/zh-CN/elasticsearch/client/java-rest/6.2/java-rest-low-usage-initialization.html
EDIT: Regarding FLUSH/REFRESH and CLUSTER_STATE this feature will be available on the next release... 编辑:关于FLUSH / REFRESH和CLUSTER_STATE,此功能将在下一版本中可用...
(On 6.3.0) Refresh -> https://github.com/elastic/elasticsearch/pull/27799 (On 6.3.0)Flush -> https://github.com/elastic/elasticsearch/pull/28852 Cluster state -> not started (关于6.3.0)刷新-> https://github.com/elastic/elasticsearch/pull/27799 (关于6.3.0)刷新-> https://github.com/elastic/elasticsearch/pull/28852集群状态->未开始
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.