How to expose elasticsearch via http://my-domain.com:9200

Hi,

A few days ago, i installed elasticsearch.

it is working well with localhost:9200 with curl command
showing as -
{
"name" : "2Ui6lx9",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "kBm0cR_tTmG3vl3R4sd2eg",
"version" : {
"number" : "6.4.2",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "04711c2",
"build_date" : "2018-09-26T13:34:09.098244Z",
"build_snapshot" : false,
"lucene_version" : "7.4.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}

but when i am using it via http://my-domain.com:9200 then it is not working.

How to expose the same service with http://my-domain:9200 ?

Thank You !

Have you setup DNS to point my-domain.com to the Elasticsearch host?

Be careful and do not expose your Elasticsearch cluster to the internet without securing it first.

Hey @warkolm

Not yet!
How to do ?

Thanks for your reply.

Hi @Christian_Dahlqvist

How to secure it?
and then how to expose?

Thanks for your reply !

Who is going to access the cluster? What is the use case?

This guide shows how to secure Elasticsearch using the commercial security features. If you have a small use-case, the easiest way to get access to this is by using our hosted Elasticsearch Service.

You can also enable a password for the HTTP protocol by making Elasticsearch bind to the loopback interface and introduce a reverse proxy to handle authentication. It is however usually hard to handle anything but authentication this way.