Unable connect to Elasticsearch from another machine

I installed Elasticsearch on one machine and my application, developed with Spring Boot, on another machine. When I try to connect, I face a connection refused error. However, when I run the command :
curl http://server_ip:9200
on the application machine, I receive the following response:

{
  "name" : "localhost.localdomain",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "_cTpYoMhTUqR9hmt-q93oA",
  "version" : {
    "number" : "8.9.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "a813d015ef1826148d9d389bd1c0d781c6e349f0",
    "build_date" : "2023-08-10T05:02:32.517455352Z",
    "build_snapshot" : false,
    "lucene_version" : "9.7.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

Additionally, here are my application.properties :

spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=http://server_ip:9200
spring.data.elasticsearch.repositories.enabled=true

And my elasticsearch.yml :

# Enable security features
xpack.security.enabled: false

xpack.security.enrollment.enabled: false

# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
  enabled: true
  keystore.path: certs/http.p12

# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
cluster.initial_master_nodes: ["localhost.localdomain"]

# Allow HTTP API connections from anywhere
# Connections are encrypted and require user authentication
http.host: 0.0.0.0

What should I do to solve this problem?

http://server_ip:9200

This should be:

https://server_ip:9200

no?

Could you share the Elasticsearch logs please?

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