简体   繁体   中英

Spring Data Elasticsearch external ES Server

我正在为我的应用程序使用Spring Data ElasticSearch,但是Spring Data ElasticSearch将ES嵌入到spring中,是否可以将其连接到外部Elasticsearch服务器?

For connecting to node client (AKA embeded node)

  <elasticsearch:node-client id="client" local="true" cluster-name="testCluster" http-enabled="false"/>

To connect external server by specifying server nodes and cluster name , note that cluster-nodes argument can be multiple nodes comma separated

 <elasticsearch:transport-client id="client" cluster-name="elasticsearch" cluster-nodes="127.0.0.1:9300" />

Hope this helps

You can connect to an external cluster using transport client as in the following code.

<elasticsearch:transport-client id="elasticsearchClient" cluster-nodes="<ip>:<port>"/>

You can pass this to elasticsearchtemplate and use accordingly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM