Help with the Node.js Javascript API


(Houseman) #1

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c8467e15-f93a-48fe-983d-286af5ba962d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Houseman) #2

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/6978d7be-94b1-4d74-93a8-e45d47937d28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3