Access Secure Elastisearch Cluster from Ruby on Rails

I have setup a secure Elastisearch cluster with three nodes using the official installation with Docker Compose guide.

It is being accessed from Kibana without issue. However now I need to access it from my custom ROR application. For that, I am using the official gem. But my application is unable to access anything at port 9200, Xpack security is enabled which is causing the issue.

I can get it to work fine by disabling Xpack. How would I go about keeping the Xpack security enabled and still accessing the Elasticsearch REST API endpoint from my application code?

Welcome to our community! :smiley:

If Kibana can access things with Security enabled then other things should. You will need to provide a bit more info on what is happening with your app though. Showing the code would be good, as would and errors that Elasticsearch it sending back to the client.

1 Like

Thanks :slight_smile:

Yes, I know it can be accessed by providing the proper cert & password, sorry for the weird wording.
The main question I mean to ask is how to configure the Elasticsearch client with an enrollment token in my rails application. Kibana is able to access it because it has been configured with the proper certificate in docker-compose. But my rails application is running on my machine, not a docker instance. Therefore I am at a loss on how to keep security and still connect.

You don't use an enrolment token, have a look at Connecting | Elasticsearch Ruby Client [8.5] | Elastic for an example.

1 Like

Thank you so much, I knew I was missing something very obvious but couldn't get my head around it.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.