连接到Elasticsearch Heroku数据库 [英] Connect to Elasticsearch Heroku database

查看:102
本文介绍了连接到Elasticsearch Heroku数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Heroku上使用Bonsai elasticsearch附加组件设置了一个入门帐户.我正在尝试通过Java应用程序连接到它,但似乎无法通过Elastic Client文档页面上说明的Transport Client或NodeBuilder选项进行连接.

I've set up a starter account on Heroku with a Bonsai elasticsearch add-on. I'm trying to connect to it via a Java application, but can't seem to connect via either Transport Client or the NodeBuilder options that are explained on the elasticsearch documentation pages.

我可以运行以下CURL来发布数据:

I can run the following CURL to post data:

curl -XPOST http://banyan-7086980.us-east-1.bonsai.io/med/test/hello3 -d '{"title":"Hello world2"}'

我当前的思路是:

    Client client = new TransportClient()
            .addTransportAddress(new InetSocketTransportAddress("http://banyan-7086980.us-east-1.bonsai.io", 9300));

但是这不起作用.我想念什么?

But this is not working. What am I missing?

推荐答案

大多数在Heroku上提供托管Elasticsearch的服务均不支持HTTP以外的任何其他传输方式.与Java中的Elasticsearch进行交互的规范方法是使用Transport客户端或Node客户端,您已经尝试将它们都连接到HTTP端点.

Most services that offer hosted Elasticsearch on Heroku does not support any other transport than HTTP. The canonical way of interfacing with Elasticsearch from Java is using either the Transport client or the Node client, both of which you've tried connecting to HTTP-endpoints.

传输和节点客户端使用与HTTP不兼容的自定义二进制协议.

The transport and node clients use a custom-built binary protocol which is not compatible with HTTP.

此外,默认情况下,此二进制协议不支持您在生产设置中应该期望的一些核心功能:身份验证和加密.

Additionally, this binary protocol by default does not support some core features you should expect in a production setup: authentication and encryption.

如果您的要求包括在Heroku上运行并使用官方Java客户端,请查看在Heroku上找到Elasticsearch ,它使用自定义传输模块为传输客户端提供支持: https://github.com /foundit/elasticsearch-transport-module

If your requirements include running on Heroku and using the official Java clients, have a look at Found Elasticsearch on Heroku, which provides support for the transport client using a custom transport module: https://github.com/foundit/elasticsearch-transport-module

披露:我是找到的

这篇关于连接到Elasticsearch Heroku数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆