如何配置弹性搜索5 [英] How to configure elasticsearch 5
本文介绍了如何配置弹性搜索5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何配置elasticsearch 5 TransportClient。
现在TransportClient是抽象类。我发现只有PreBuiltTransportClient,这是配置弹性搜索客户端的新方法?
解决方案
是的,你可以在 5.0的官方文档以及
设置设置= Settings.builder()
.put(cluster.name,ElasticSearchClusterName);
TransportClient client = new PreBuiltTransportClient(settings)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(host1),9300))
.addTransportAddress(new InetSocketTransportAddress(InetAddress。 getByName(host2),9300));
没有什么是 PreBuiltTransportClient
$ b
- Netty3
- Netty4
- Reindex
- Percolator
- 胡子
还要确保你依赖于运输
工件:
<依赖性>
< groupId> org.elasticsearch.client< / groupId>
< artifactId> transport< / artifactId>
< version> 5.0.0-beta1< / version>
< / dependency>
How to configure elasticsearch 5 TransportClient.
Now TransportClient is abstract class. I found only PreBuiltTransportClient, this is the new way to configure elasticsearch Client ?
解决方案
Yes, you can find that in the official documentation for 5.0 as well
Settings settings = Settings.builder()
.put("cluster.name", "ElasticSearchClusterName");
TransportClient client = new PreBuiltTransportClient(settings)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host1"), 9300))
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host2"), 9300));
It is worth nothing that the PreBuiltTransportClient
is pre-configured with the following modules:
- Netty3
- Netty4
- Reindex
- Percolator
- Mustache
Also make sure that you have a dependency on the transport
artifact:
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.0.0-beta1</version>
</dependency>
这篇关于如何配置弹性搜索5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文