Curl -X GET 'http://localhost:9200' curl: (52) Empty reply from server

elasticsearch service is active and running but got this error while accessing 9200, elasticsearch.yml file is properly configuredcurl -X GET 'http://localhost:9200' curl: (52) Empty reply from server

Hi @Adarsh_R_K Welcome to the community!

What version?

How did you install?

Did you try.

curl -k -u elastic:password https://localhost:9200

I am using the 8.7 version
installed through curl command
I put "xpack.security.enabled: false" in elasticsearch.yml file and it worked, may I know this is the correct solution.
Thanks

I'm not quite sure what you mean by that

It's a solution if you do not want any security.

If you do want security, start over and follow the documents.

Ohk got it
Thanks

Hi @Adarsh_R_K

  1. If you set these options true in elasticsearch.yml. You can Set the password elasticsearch and all other.
    xpack.security.enabled: true
    xpack.security.transport.ssl.enabled: true

service elasticsearch restart

#command for setting up password
./elasticsearch-setup-passwords interactive

Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y

Enter password for [elastic]:
Reenter password for [elastic]:

later u can do
curl -X GET "http://username:password@localhost:9200

Output look like

In this case how can i configure the username and password in the java client libarary
help is much appreciated.