# Help with the Node.js Javascript API

**URL:** <https://discuss.elastic.co/t/help-with-the-node-js-javascript-api/17607>\
**Category:** Elasticsearch\
**Created:** [May 20, 2014, 2:34am UTC](https://discuss.elastic.co/t/help-with-the-node-js-javascript-api/17607 "2014-05-20T02:34:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Houseman](https://avatars.discourse-cdn.com/v4/letter/h/c77e96/32.png) [@Houseman](https://discuss.elastic.co/u/Houseman)\
**Post date:** [May 20, 2014, 2:34am UTC](https://discuss.elastic.co/t/help-with-the-node-js-javascript-api/17607/1 "2014-05-20T02:34:41Z")

</div>

Here's my local node.js server.

var elasticsearch = require('elasticsearch');  
var client = new elasticsearch.Client({  
host: server:9200',  
log:'trace'  
});

client.search({  
q:'slide'  
},function (error,response){  
if(error){  
console.log(error);  
}  
if(response){  
console.log(response);  
}  
});

This returns no hits.

However, when I copy and paste the POST from the trace into a browser, I  
get everything I search for.

Here's the trace:

Elasticsearch TRACE: 2014-05-20T02:04:49Z  
-\> POST http:  
//server:9200/530d8aa855df0c2d269a5a58/532a2b28495c533e5eaeb020/\_search  
{  
"query": {  
"match": {  
"body": "slide"  
}  
},  
"highlight": {  
"fields": {  
"content": {  
"fragment\_size": 150,  
"number\_of\_fragments": 3,  
"no\_match\_size": 150  
}  
}  
}  
}  
\<- 200  
{  
"took": 3,  
"timed\_out": false,  
"\_shards": {  
"total": 5,  
"successful": 5,  
"failed": 0  
},  
"hits": {  
"total": 0,  
"max\_score": null,  
"hits": []  
}  
}

What am I doing wrong?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/c8467e15-f93a-48fe-983d-286af5ba962d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c8467e15-f93a-48fe-983d-286af5ba962d%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Houseman](https://avatars.discourse-cdn.com/v4/letter/h/c77e96/32.png) [@Houseman](https://discuss.elastic.co/u/Houseman)\
**Post date:** [May 20, 2014, 9:39pm UTC](https://discuss.elastic.co/t/help-with-the-node-js-javascript-api/17607/2 "2014-05-20T21:39:17Z")

</div>

Looks like either my version, or the documentation is wrong, because I can  
run queries by using "query: 'text' " instead of "q: 'text' ".

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6978d7be-94b1-4d74-93a8-e45d47937d28%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6978d7be-94b1-4d74-93a8-e45d47937d28%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:28am UTC](https://discuss.elastic.co/t/help-with-the-node-js-javascript-api/17607/3 "2017-07-06T01:28:02Z")

</div>


