# ElasticSearch javascript client error

**URL:** <https://discuss.elastic.co/t/elasticsearch-javascript-client-error/13697>\
**Category:** Elasticsearch\
**Created:** [September 20, 2013, 12:27am UTC](https://discuss.elastic.co/t/elasticsearch-javascript-client-error/13697 "2013-09-20T00:27:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joris\_Bolsens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joris_bolsens/32/1648_2.png) [@Joris\_Bolsens](https://discuss.elastic.co/u/Joris_Bolsens)\
**Post date:** [September 20, 2013, 12:27am UTC](https://discuss.elastic.co/t/elasticsearch-javascript-client-error/13697/1 "2013-09-20T00:27:27Z")

</div>

hello all,

I am getting a very strange error when trying to search for a document  
using [GitHub - phillro/node-elasticsearch-client: A client written in node for elastic search](https://github.com/phillro/node-elasticsearch-client)  
the full error message can be found here: [org.elasticsearch.search.SearchParseException: [test][2]: from[-1],size[-1]: Par - Pastebin.com](http://pastebin.com/JSDnqxtm)

My search code is as follows (am trying to test the client out)  
var ElasticSearchClient = require('elasticsearchclient');

var serverOptions = {  
host: 'localhost',  
port: 9200  
};  
var elasticSearchClient = new ElasticSearchClient(serverOptions);  
var qryObj = {  
field1 : 'tags'  
}

elasticSearchClient.search('test', 'tags', qryObj)  
.on('data', function(data) {  
console.log(JSON.parse(data))  
})  
.on('done', function(){  
//always returns 0 right now  
})  
.on('error', function(error){  
console.log(error)  
})  
.exec()

I have checked elasticsearch head and the document is there.  
The only thing I can tell from the error is that there seems to be an error  
parsing the document

The error that the javascript client shows is as follows (note, this is  
shown as 'data' not 'error':

> {"error":"SearchPhaseExecutionException[Failed to execute phase [query],  
> all shards failed; shardFailures {[i87dRn9lTJKavNGeDsLmzw][test][4]:  
> SearchParseException[[test][4]: from[-1],size[-1]: Parse Failure [Failed to  
> parse source [{"field1":"tags"}]]]; nested:  
> SearchParseException[[test][4]: from[-1],size[-1]: Parse Failure [No parser  
> for element [field1]]]; }{[i87dRn9lTJKavNGeDsLmzw][test][3]:  
> SearchParseException[[test][3]: from[-1],size[-1]: Parse Failure [Failed to  
> parse source [{"field1":"tags"}]]]; nested:  
> SearchParseException[[test][3]: from[-1],size[-1]: Parse Failure [No parser  
> for element [field1]]]; }{[i87dRn9lTJKavNGeDsLmzw][test][2]:  
> SearchParseException[[test][2]: from[-1],size[-1]: Parse Failure [Failed to  
> parse source [{"field1":"tags"}]]]; nested:  
> SearchParseException[[test][2]: from[-1],size[-1]: Parse Failure [No parser  
> for element [field1]]]; }{[i87dRn9lTJKavNGeDsLmzw][test][0]:  
> SearchParseException[[test][0]: from[-1],size[-1]: Parse Failure [Failed to  
> parse source [{"field1":"tags"}]]]; nested:  
> SearchParseException[[test][0]: from[-1],size[-1]: Parse Failure [No parser  
> for element [field1]]]; }{[i87dRn9lTJKavNGeDsLmzw][test][1]:  
> SearchParseException[[test][1]: from[-1],size[-1]: Parse Failure [Failed to  
> parse source [{"field1":"tags"}]]]; nested:  
> SearchParseException[[test][1]: from[-1],size[-1]: Parse Failure [No parser  
> for element [field1]]]; }]","status":400}

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [September 20, 2013, 6:06am UTC](https://discuss.elastic.co/t/elasticsearch-javascript-client-error/13697/2 "2013-09-20T06:06:21Z")

</div>

Hi,  
Not an expert on this js client but from the log message it seems to me the  
json query is malformed. Can you share the whole qurey itself?  
Regards,  
Lukáš  
Dne 20.9.2013 2:27 "Joris Bolsens" [epicblood@gmail.com](mailto:epicblood@gmail.com) napsal(a):

> hello all,
> 
> I am getting a very strange error when trying to search for a document  
> using [GitHub - phillro/node-elasticsearch-client: A client written in node for elastic search](https://github.com/phillro/node-elasticsearch-client)  
> the full error message can be found here: [org.elasticsearch.search.SearchParseException: [test][2]: from[-1],size[-1]: Par - Pastebin.com](http://pastebin.com/JSDnqxtm)
> 
> My search code is as follows (am trying to test the client out)  
> var ElasticSearchClient = require('elasticsearchclient');
> 
> var serverOptions = {  
> host: 'localhost',  
> port: 9200  
> };  
> var elasticSearchClient = new ElasticSearchClient(serverOptions);  
> var qryObj = {  
> field1 : 'tags'  
> }
> 
> elasticSearchClient.search('test', 'tags', qryObj)  
> .on('data', function(data) {  
> console.log(JSON.parse(data))  
> })  
> .on('done', function(){  
> //always returns 0 right now  
> })  
> .on('error', function(error){  
> console.log(error)  
> })  
> .exec()
> 
> I have checked elasticsearch head and the document is there.  
> The only thing I can tell from the error is that there seems to be an  
> error parsing the document
> 
> The error that the javascript client shows is as follows (note, this is  
> shown as 'data' not 'error':
> 
> > {"error":"SearchPhaseExecutionException[Failed to execute phase [query],  
> > all shards failed; shardFailures {[i87dRn9lTJKavNGeDsLmzw][test][4]:  
> > SearchParseException[[test][4]: from[-1],size[-1]: Parse Failure [Failed to  
> > parse source [{"field1":"tags"}]]]; nested:  
> > SearchParseException[[test][4]: from[-1],size[-1]: Parse Failure [No parser  
> > for element [field1]]]; }{[i87dRn9lTJKavNGeDsLmzw][test][3]:  
> > SearchParseException[[test][3]: from[-1],size[-1]: Parse Failure [Failed to  
> > parse source [{"field1":"tags"}]]]; nested:  
> > SearchParseException[[test][3]: from[-1],size[-1]: Parse Failure [No parser  
> > for element [field1]]]; }{[i87dRn9lTJKavNGeDsLmzw][test][2]:  
> > SearchParseException[[test][2]: from[-1],size[-1]: Parse Failure [Failed to  
> > parse source [{"field1":"tags"}]]]; nested:  
> > SearchParseException[[test][2]: from[-1],size[-1]: Parse Failure [No parser  
> > for element [field1]]]; }{[i87dRn9lTJKavNGeDsLmzw][test][0]:  
> > SearchParseException[[test][0]: from[-1],size[-1]: Parse Failure [Failed to  
> > parse source [{"field1":"tags"}]]]; nested:  
> > SearchParseException[[test][0]: from[-1],size[-1]: Parse Failure [No parser  
> > for element [field1]]]; }{[i87dRn9lTJKavNGeDsLmzw][test][1]:  
> > SearchParseException[[test][1]: from[-1],size[-1]: Parse Failure [Failed to  
> > parse source [{"field1":"tags"}]]]; nested:  
> > SearchParseException[[test][1]: from[-1],size[-1]: Parse Failure [No parser  
> > for element [field1]]]; }]","status":400}
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Joris\_Bolsens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joris_bolsens/32/1648_2.png) [@Joris\_Bolsens](https://discuss.elastic.co/u/Joris_Bolsens)\
**Post date:** [September 20, 2013, 11:33pm UTC](https://discuss.elastic.co/t/elasticsearch-javascript-client-error/13697/3 "2013-09-20T23:33:57Z")

</div>

ElasticSearchClient.prototype.search = function(indexName, typeName,queryObj  
, options, cb) {  
//Pull the callback and set it false to not clobber id.  
if(typeof arguments[arguments.length-1]=='function'){  
cb=arguments[arguments.length-1];  
arguments[arguments.length-1]=false;  
}

```
var objArgs=[]
var path=''

```

// Assumes quite a lot about the input  
for(var i=0;i\<arguments.length;i++){  
switch(typeof arguments[i]){  
case 'object':  
objArgs.push(arguments[i]);  
break;  
case 'string':  
path+='/'+arguments[i]  
break;  
}  
}

path+='/\_search';

// Is options sent as an object or a string  
// Assumes that objArgs[0] is the queryObj  
if (options !== undefined){  
switch(typeof options){  
case 'object':  
objArgs.push(options);  
path += "?" + querystring.stringify(objArgs[1]);  
break;  
case 'string':  
path += "?" + options;  
break;  
}  
}

```
var data = objArgs[0] || {};
return this.createCall({path:path,method: 'POST',data:JSON.stringify(

```

data)}, this.clientOptions, cb);  
}

On Thursday, September 19, 2013 11:06:21 PM UTC-7, Lukáš Vlček wrote:

> Hi,  
> Not an expert on this js client but from the log message it seems to me  
> the json query is malformed. Can you share the whole qurey itself?  
> Regards,  
> Lukáš  
> Dne 20.9.2013 2:27 "Joris Bolsens" \<[epic...@gmail.com](mailto:epic...@gmail.com) \<javascript:\>\>  
> napsal(a):
> 
> > hello all,
> > 
> > I am getting a very strange error when trying to search for a document  
> > using [GitHub - phillro/node-elasticsearch-client: A client written in node for elastic search](https://github.com/phillro/node-elasticsearch-client)  
> > the full error message can be found here: [org.elasticsearch.search.SearchParseException: [test][2]: from[-1],size[-1]: Par - Pastebin.com](http://pastebin.com/JSDnqxtm)
> > 
> > My search code is as follows (am trying to test the client out)  
> > var ElasticSearchClient = require('elasticsearchclient');
> > 
> > var serverOptions = {  
> > host: 'localhost',  
> > port: 9200  
> > };  
> > var elasticSearchClient = new ElasticSearchClient(serverOptions);  
> > var qryObj = {  
> > field1 : 'tags'  
> > }
> > 
> > elasticSearchClient.search('test', 'tags', qryObj)  
> > .on('data', function(data) {  
> > console.log(JSON.parse(data))  
> > })  
> > .on('done', function(){  
> > //always returns 0 right now  
> > })  
> > .on('error', function(error){  
> > console.log(error)  
> > })  
> > .exec()
> > 
> > I have checked elasticsearch head and the document is there.  
> > The only thing I can tell from the error is that there seems to be an  
> > error parsing the document
> > 
> > The error that the javascript client shows is as follows (note, this is  
> > shown as 'data' not 'error':
> > 
> > > {"error":"SearchPhaseExecutionException[Failed to execute phase [query],  
> > > all shards failed; shardFailures {[i87dRn9lTJKavNGeDsLmzw][test][4]:  
> > > SearchParseException[[test][4]: from[-1],size[-1]: Parse Failure [Failed to  
> > > parse source [{"field1":"tags"}]]]; nested:  
> > > SearchParseException[[test][4]: from[-1],size[-1]: Parse Failure [No parser  
> > > for element [field1]]]; }{[i87dRn9lTJKavNGeDsLmzw][test][3]:  
> > > SearchParseException[[test][3]: from[-1],size[-1]: Parse Failure [Failed to  
> > > parse source [{"field1":"tags"}]]]; nested:  
> > > SearchParseException[[test][3]: from[-1],size[-1]: Parse Failure [No parser  
> > > for element [field1]]]; }{[i87dRn9lTJKavNGeDsLmzw][test][2]:  
> > > SearchParseException[[test][2]: from[-1],size[-1]: Parse Failure [Failed to  
> > > parse source [{"field1":"tags"}]]]; nested:  
> > > SearchParseException[[test][2]: from[-1],size[-1]: Parse Failure [No parser  
> > > for element [field1]]]; }{[i87dRn9lTJKavNGeDsLmzw][test][0]:  
> > > SearchParseException[[test][0]: from[-1],size[-1]: Parse Failure [Failed to  
> > > parse source [{"field1":"tags"}]]]; nested:  
> > > SearchParseException[[test][0]: from[-1],size[-1]: Parse Failure [No parser  
> > > for element [field1]]]; }{[i87dRn9lTJKavNGeDsLmzw][test][1]:  
> > > SearchParseException[[test][1]: from[-1],size[-1]: Parse Failure [Failed to  
> > > parse source [{"field1":"tags"}]]]; nested:  
> > > SearchParseException[[test][1]: from[-1],size[-1]: Parse Failure [No parser  
> > > for element [field1]]]; }]","status":400}
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Joris\_Bolsens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joris_bolsens/32/1648_2.png) [@Joris\_Bolsens](https://discuss.elastic.co/u/Joris_Bolsens)\
**Post date:** [September 20, 2013, 11:35pm UTC](https://discuss.elastic.co/t/elasticsearch-javascript-client-error/13697/4 "2013-09-20T23:35:45Z")

</div>

Not sure how to get the actual query itself as I am new to Javascript,  
however, here is the code to the search function:

ElasticSearchClient.prototype.search = function(indexName, typeName,queryObj  
, options, cb) {  
//Pull the callback and set it false to not clobber id.  
if(typeof arguments[arguments.length-1]=='function'){  
cb=arguments[arguments.length-1];  
arguments[arguments.length-1]=false;  
}

```
var objArgs=[]
var path=''

```

// Assumes quite a lot about the input  
for(var i=0;i\<arguments.length;i++){  
switch(typeof arguments[i]){  
case 'object':  
objArgs.push(arguments[i]);  
break;  
case 'string':  
path+='/'+arguments[i]  
break;  
}  
}

path+='/\_search';

// Is options sent as an object or a string  
// Assumes that objArgs[0] is the queryObj  
if (options !== undefined){  
switch(typeof options){  
case 'object':  
objArgs.push(options);  
path += "?" + querystring.stringify(objArgs[1]);  
break;  
case 'string':  
path += "?" + options;  
break;  
}  
}

```
var data = objArgs[0] || {};
return this.createCall({path:path,method: 'POST',data:JSON.stringify(

```

data)}, this.clientOptions, cb);  
}

On Thursday, September 19, 2013 11:06:21 PM UTC-7, Lukáš Vlček wrote:

> Hi,  
> Not an expert on this js client but from the log message it seems to me  
> the json query is malformed. Can you share the whole qurey itself?  
> Regards,  
> Lukáš  
> Dne 20.9.2013 2:27 "Joris Bolsens" \<[epic...@gmail.com](mailto:epic...@gmail.com) \<javascript:\>\>  
> napsal(a):
> 
> > hello all,
> > 
> > I am getting a very strange error when trying to search for a document  
> > using [GitHub - phillro/node-elasticsearch-client: A client written in node for elastic search](https://github.com/phillro/node-elasticsearch-client)  
> > the full error message can be found here: [org.elasticsearch.search.SearchParseException: [test][2]: from[-1],size[-1]: Par - Pastebin.com](http://pastebin.com/JSDnqxtm)
> > 
> > My search code is as follows (am trying to test the client out)  
> > var ElasticSearchClient = require('elasticsearchclient');
> > 
> > var serverOptions = {  
> > host: 'localhost',  
> > port: 9200  
> > };  
> > var elasticSearchClient = new ElasticSearchClient(serverOptions);  
> > var qryObj = {  
> > field1 : 'tags'  
> > }
> > 
> > elasticSearchClient.search('test', 'tags', qryObj)  
> > .on('data', function(data) {  
> > console.log(JSON.parse(data))  
> > })  
> > .on('done', function(){  
> > //always returns 0 right now  
> > })  
> > .on('error', function(error){  
> > console.log(error)  
> > })  
> > .exec()
> > 
> > I have checked elasticsearch head and the document is there.  
> > The only thing I can tell from the error is that there seems to be an  
> > error parsing the document
> > 
> > The error that the javascript client shows is as follows (note, this is  
> > shown as 'data' not 'error':
> > 
> > > {"error":"SearchPhaseExecutionException[Failed to execute phase [query],  
> > > all shards failed; shardFailures {[i87dRn9lTJKavNGeDsLmzw][test][4]:  
> > > SearchParseException[[test][4]: from[-1],size[-1]: Parse Failure [Failed to  
> > > parse source [{"field1":"tags"}]]]; nested:  
> > > SearchParseException[[test][4]: from[-1],size[-1]: Parse Failure [No parser  
> > > for element [field1]]]; }{[i87dRn9lTJKavNGeDsLmzw][test][3]:  
> > > SearchParseException[[test][3]: from[-1],size[-1]: Parse Failure [Failed to  
> > > parse source [{"field1":"tags"}]]]; nested:  
> > > SearchParseException[[test][3]: from[-1],size[-1]: Parse Failure [No parser  
> > > for element [field1]]]; }{[i87dRn9lTJKavNGeDsLmzw][test][2]:  
> > > SearchParseException[[test][2]: from[-1],size[-1]: Parse Failure [Failed to  
> > > parse source [{"field1":"tags"}]]]; nested:  
> > > SearchParseException[[test][2]: from[-1],size[-1]: Parse Failure [No parser  
> > > for element [field1]]]; }{[i87dRn9lTJKavNGeDsLmzw][test][0]:  
> > > SearchParseException[[test][0]: from[-1],size[-1]: Parse Failure [Failed to  
> > > parse source [{"field1":"tags"}]]]; nested:  
> > > SearchParseException[[test][0]: from[-1],size[-1]: Parse Failure [No parser  
> > > for element [field1]]]; }{[i87dRn9lTJKavNGeDsLmzw][test][1]:  
> > > SearchParseException[[test][1]: from[-1],size[-1]: Parse Failure [Failed to  
> > > parse source [{"field1":"tags"}]]]; nested:  
> > > SearchParseException[[test][1]: from[-1],size[-1]: Parse Failure [No parser  
> > > for element [field1]]]; }]","status":400}
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Joris\_Bolsens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joris_bolsens/32/1648_2.png) [@Joris\_Bolsens](https://discuss.elastic.co/u/Joris_Bolsens)\
**Post date:** [September 21, 2013, 12:06am UTC](https://discuss.elastic.co/t/elasticsearch-javascript-client-error/13697/5 "2013-09-21T00:06:33Z")

</div>

Also, I am using Elasticsearch 0.90.5

On Friday, September 20, 2013 4:35:45 PM UTC-7, Joris Bolsens wrote:

> Not sure how to get the actual query itself as I am new to Javascript,  
> however, here is the code to the search function:
> 
> ElasticSearchClient.prototype.search = function(indexName, typeName,queryObj  
> , options, cb) {  
> //Pull the callback and set it false to not clobber id.  
> if(typeof arguments[arguments.length-1]=='function'){  
> cb=arguments[arguments.length-1];  
> arguments[arguments.length-1]=false;  
> }
> 
> ```
> var objArgs=[]
> var path=''
> 
> ```
> 
> // Assumes quite a lot about the input  
> for(var i=0;i\<arguments.length;i++){  
> switch(typeof arguments[i]){  
> case 'object':  
> objArgs.push(arguments[i]);  
> break;  
> case 'string':  
> path+='/'+arguments[i]  
> break;  
> }  
> }
> 
> path+='/\_search';
> 
> // Is options sent as an object or a string  
> // Assumes that objArgs[0] is the queryObj  
> if (options !== undefined){  
> switch(typeof options){  
> case 'object':  
> objArgs.push(options);  
> path += "?" + querystring.stringify(objArgs[1]);  
> break;  
> case 'string':  
> path += "?" + options;  
> break;  
> }  
> }
> 
> ```
> var data = objArgs[0] || {};
> return this.createCall({path:path,method: 'POST',data:JSON.stringify(
> 
> ```
> 
> data)}, this.clientOptions, cb);  
> }
> 
> On Thursday, September 19, 2013 11:06:21 PM UTC-7, Lukáš Vlček wrote:
> 
> > Hi,  
> > Not an expert on this js client but from the log message it seems to me  
> > the json query is malformed. Can you share the whole qurey itself?  
> > Regards,  
> > Lukáš  
> > Dne 20.9.2013 2:27 "Joris Bolsens" [epic...@gmail.com](mailto:epic...@gmail.com) napsal(a):
> > 
> > > hello all,
> > > 
> > > I am getting a very strange error when trying to search for a document  
> > > using [GitHub - phillro/node-elasticsearch-client: A client written in node for elastic search](https://github.com/phillro/node-elasticsearch-client)  
> > > the full error message can be found here: [org.elasticsearch.search.SearchParseException: [test][2]: from[-1],size[-1]: Par - Pastebin.com](http://pastebin.com/JSDnqxtm)
> > > 
> > > My search code is as follows (am trying to test the client out)  
> > > var ElasticSearchClient = require('elasticsearchclient');
> > > 
> > > var serverOptions = {  
> > > host: 'localhost',  
> > > port: 9200  
> > > };  
> > > var elasticSearchClient = new ElasticSearchClient(serverOptions);  
> > > var qryObj = {  
> > > field1 : 'tags'  
> > > }
> > > 
> > > elasticSearchClient.search('test', 'tags', qryObj)  
> > > .on('data', function(data) {  
> > > console.log(JSON.parse(data))  
> > > })  
> > > .on('done', function(){  
> > > //always returns 0 right now  
> > > })  
> > > .on('error', function(error){  
> > > console.log(error)  
> > > })  
> > > .exec()
> > > 
> > > I have checked elasticsearch head and the document is there.  
> > > The only thing I can tell from the error is that there seems to be an  
> > > error parsing the document
> > > 
> > > The error that the javascript client shows is as follows (note, this is  
> > > shown as 'data' not 'error':
> > > 
> > > > {"error":"SearchPhaseExecutionException[Failed to execute phase  
> > > > [query], all shards failed; shardFailures  
> > > > {[i87dRn9lTJKavNGeDsLmzw][test][4]: SearchParseException[[test][4]:  
> > > > from[-1],size[-1]: Parse Failure [Failed to parse source  
> > > > [{"field1":"tags"}]]]; nested: SearchParseException[[test][4]:  
> > > > from[-1],size[-1]: Parse Failure [No parser for element [field1]]];  
> > > > }{[i87dRn9lTJKavNGeDsLmzw][test][3]: SearchParseException[[test][3]:  
> > > > from[-1],size[-1]: Parse Failure [Failed to parse source  
> > > > [{"field1":"tags"}]]]; nested: SearchParseException[[test][3]:  
> > > > from[-1],size[-1]: Parse Failure [No parser for element [field1]]];  
> > > > }{[i87dRn9lTJKavNGeDsLmzw][test][2]: SearchParseException[[test][2]:  
> > > > from[-1],size[-1]: Parse Failure [Failed to parse source  
> > > > [{"field1":"tags"}]]]; nested: SearchParseException[[test][2]:  
> > > > from[-1],size[-1]: Parse Failure [No parser for element [field1]]];  
> > > > }{[i87dRn9lTJKavNGeDsLmzw][test][0]: SearchParseException[[test][0]:  
> > > > from[-1],size[-1]: Parse Failure [Failed to parse source  
> > > > [{"field1":"tags"}]]]; nested: SearchParseException[[test][0]:  
> > > > from[-1],size[-1]: Parse Failure [No parser for element [field1]]];  
> > > > }{[i87dRn9lTJKavNGeDsLmzw][test][1]: SearchParseException[[test][1]:  
> > > > from[-1],size[-1]: Parse Failure [Failed to parse source  
> > > > [{"field1":"tags"}]]]; nested: SearchParseException[[test][1]:  
> > > > from[-1],size[-1]: Parse Failure [No parser for element [field1]]];  
> > > > }]","status":400}
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [September 21, 2013, 5:55am UTC](https://discuss.elastic.co/t/elasticsearch-javascript-client-error/13697/6 "2013-09-21T05:55:17Z")

</div>

Hi Joris,

I never used this client so I might be wrong, however, based on quick  
investigation of the source code I would expect that the `queryObj`  
parameter should be valid Query DSL entity. See for example some tests here:

> <https://github.com/phillro/node-elasticsearch-client/blob/master/test/core.test.js#L156>

You are passing in {"field1":"tags"} which IMO does not match any query,  
not even the field query [1].

In any case you can use developer tools in your web browser to check how  
exactly the URL request looks like and what is the body of the request.

[1] [http://www.elasticsearch.org/guide/reference/query-dsl/field-query/](http://www.elasticsearch.org/guide/reference/query-dsl/field-query/)

HTH,  
Lukas

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:15am UTC](https://discuss.elastic.co/t/elasticsearch-javascript-client-error/13697/7 "2017-07-06T02:15:15Z")

</div>


