Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elasticsearch remote access through SSH

About Elasticsearch HTTP API, I wonder if I want to remote access a cluster on SSH server, what should I include in my http rest command:

    curl -XGET ' http://localhost:9200/ index /_mapping/ type ' 

I have tried something like below but got failed:

    curl -XGET -u cloud-user: --key ~/.ssh/id_rsa --pubkey ~/.ssh/id_rsa.pub  'xx.xxx.xxx.xxx:9200/index/_mapping/type'

Is there anyone knows the correct command or alternative solution?

like image 923
user30851 Avatar asked Aug 04 '26 23:08

user30851


1 Answers

If you are on *NIX environment it is easy, just tunnel over ssh

ssh -Nf -L 9200:localhost:9200 [email protected]

Later you fetch the remote by localhost, as tunneled above

curl -XGET 'http://localhost:9200/_search'
like image 151
Thiago Macedo Avatar answered Aug 08 '26 00:08

Thiago Macedo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!