gpt4 book ai didi

java - 如何连接到 AWS Elasticsearch?

转载 作者:搜寻专家 更新时间:2023-10-30 21:45:11 24 4
gpt4 key购买 nike

我正在尝试连接到 AWS Elasticsearch,但我总是收到以下错误:

Exception in thread "main" org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:278)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:197)
at org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106)
at org.elasticsearch.client.support.AbstractClient.index(AbstractClient.java:98)
at org.elasticsearch.client.transport.TransportClient.index(TransportClient.java:334)
at org.elasticsearch.action.index.IndexRequestBuilder.doExecute(IndexRequestBuilder.java:313)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)
at com.c_backendcrawler.utility.ElasticSearch.uploadObject(ElasticSearch.java:25)
at com.c_backendcrawler.Start.main(Start.java:34)

我的代码如下:

 //Create Client
Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "zencubes-search").put("node.name","Darkhawk").build();
TransportClient transportClient = new TransportClient(settings);
transportClient.addTransportAddress(new InetSocketTransportAddress(
"x.x.x.x",9300));
return transportClient;

AWS Elasticsearch 的输出:

    {
status: 200,
name: "Darkhawk",
cluster_name: "817880037706:zencubes-search",
version: {
number: "1.5.2",
build_hash: "62ff9868b4c8a0c45860bebb259e21980778ab1c",
build_timestamp: "2015-04-27T09:21:06Z",
build_snapshot: false,
lucene_version: "4.10.4"
},
tagline: "You Know, for Search"
}

我尝试 curl ( https://search-zencubes-search-xxxxxxxx.eu-west-1.es.amazonaws.com/ ) 并且它有效 - 但不是在端口 9300 上。我在这里做错了什么?

最佳答案

native 传输协议(protocol)不支持使用 AWS Managed ElasticSearch,并且只能通过 REST 端点使用。考虑切换您的客户端以使用 REST 端点,例如 https://github.com/searchbox-io/Jest .

来源:https://forums.aws.amazon.com/thread.jspa?messageID=681938

关于java - 如何连接到 AWS Elasticsearch?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33412635/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com