# Elasticsearch with node.JS

**URL:** <https://discuss.elastic.co/t/elasticsearch-with-node-js/55013>\
**Category:** Elasticsearch\
**Created:** [July 8, 2016, 3:56am UTC](https://discuss.elastic.co/t/elasticsearch-with-node-js/55013 "2016-07-08T03:56:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeevan\_jeevanreddy](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jeevan\_jeevanreddy](https://discuss.elastic.co/u/jeevan_jeevanreddy)\
**Post date:** [July 8, 2016, 3:56am UTC](https://discuss.elastic.co/t/elasticsearch-with-node-js/55013/1 "2016-07-08T03:56:29Z")

</div>

I'm implementing REST API's of elasticsearch through node.js .  
node.js script in one machine,elasticsearch in another machine.  
I need to print the response of elasticsearch on web console instead of node.js  
how can i do it?

node.js script:

var express = require('express');  
var app = express();  
var elasticsearch = require('elasticsearch');  
var client = new elasticsearch.Client({  
host: '10.96.82.98:9200',  
log: 'trace'  
});  
require('node-monkey').start({host: "10.96.60.22", port:"3000"});  
app.get('/:index/:type/:id', function(req, res){  
client.get({  
"index":req.params.index,  
"type":req.params.type,  
"id":req.params.id  
}).then(function (body) {  
var hits = body.hits.hits;  
}, function (error) {  
console.trace(error.message);  
});  
});  
var port= 9300;  
app.listen(port, function() {  
console.log("Listening on " + port);  
});

i'm getting the response on node console........ needed on web console

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:37pm UTC](https://discuss.elastic.co/t/elasticsearch-with-node-js/55013/2 "2017-07-05T22:37:12Z")

</div>


