0
i have my data residing on an SSH server and i want to inquire and retrieve the data via HTTP POST and GET requests. i have been trying to do that using the simple url's http://127.0.0.1:9200/_search? but it gives me an empty response. What is the correct way to send requests over ssh server through http? my http post function looks something like this:
function spatialsearch(coordinates_selected) {
var coords = coordinates_selected.geometry.coordinates;
console.log('c',JSON.stringify(coordinates_selected.geometry.coordinates));
var _url = 'http://127.0.0.1:9200/_search?';
var b = {
"query": {
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_shape": {
"metadata.o2r.spatial.geometry": {
"shape": {
"type": "polygon",
"coordinates":
coords
/* [
// [-22.0, 76.0],
// [-27.0, 65.0],
// [-57.0, 65.0],
// [-59.0, 76.0],
// [-22.0, 76.0]
]*/
},
"relation": "within"
}}}}}
};
console.log(b,'http sending request');
return $http.post(_url,b);
}
i tried SSH tunneling using ssh -L9201:sshserver:9200 r_chau02@sshserver but i am still not getting any response.
update i updated the port in my code to 9201 but still the result was same. The error in console is net::ERR_EMPTY_RESPONSE while the terminal generates channel 3: open failed: connect failed: Connection refused.
This doesn't really sounds like it makes sense. SSH is SSH and HTTP is HTTP. I don't really get what you're trying to do. Do you have a webserver that would be able to answer the HTTP request? – Seth – 2017-05-17T08:35:18.863
@Seth i have webserver on which elasticsearch instance and all my data resides and which i access through SSH and now i have created an HTTP query to fetch that data but it's returning a bad request (400). The server is just a normal server. hope this clears out confusion – Rehan – 2017-05-17T08:45:09.490