ElasticSearch javascript client error

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
the full error message can be found here: org.elasticsearch.search.SearchParseException: [test][2]: from[-1],size[-1]: Par - Pastebin.com

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.
For more options, visit https://groups.google.com/groups/opt_out.

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 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
the full error message can be found here: org.elasticsearch.search.SearchParseException: [test][2]: from[-1],size[-1]: Par - Pastebin.com

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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.

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 <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
the full error message can be found here: org.elasticsearch.search.SearchParseException: [test][2]: from[-1],size[-1]: Par - Pastebin.com

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 <javascript:>.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.

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 <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
the full error message can be found here: org.elasticsearch.search.SearchParseException: [test][2]: from[-1],size[-1]: Par - Pastebin.com

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 <javascript:>.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.

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 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
the full error message can be found here: org.elasticsearch.search.SearchParseException: [test][2]: from[-1],size[-1]: Par - Pastebin.com

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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.

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:

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/

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.
For more options, visit https://groups.google.com/groups/opt_out.