SearchParseException JS client


(John) #1

I'm working on a JS client and having issues querying my index. I can use CURL to query it but my JS client fails to parse the query and I get the exception below. What am I doing wrong?

Version1:
client.search(
{
index:'blog',
q: 'user:dilbert'
},
function (err, resp)
{
if (err)
{
alert("Query Error: "+ err.message);
}
else
{
var hits = resp.body.hits;
alert("hits = " + hits);
}
}
);

Version2:
client.search({
index: 'blog',
body: {
query: {
match: {
body: 'dilbert'
}
}
}
}).then(function (resp) {
var hits = resp.hits.hits;
}, function (err) {
alert(err.message);
});

[2015-07-29 17:29:48,276][DEBUG][action.search.type ] [Black Talon] [blog]
[2], node[7P3BV3fuTJqRwvvc3Wmcvw], [P], s[STARTED]: Failed to execute [org.elast
icsearch.action.search.SearchRequest@16ffd379] lastShard [true]
org.elasticsearch.search.SearchParseException: [blog][2]: from[-1],size[-1]: Par
se Failure [Failed to parse source [na]]
at org.elasticsearch.search.SearchService.parseSource(SearchService.java
:735)
at org.elasticsearch.search.SearchService.createContext(SearchService.ja
va:560)
at org.elasticsearch.search.SearchService.createAndPutContext(SearchServ
ice.java:532)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchServic
e.java:294)
at org.elasticsearch.search.action.SearchServiceTransportAction$5.call(S
earchServiceTransportAction.java:231)
at org.elasticsearch.search.action.SearchServiceTransportAction$5.call(S
earchServiceTransportAction.java:228)
at org.elasticsearch.search.action.SearchServiceTransportAction$23.run(S
earchServiceTransportAction.java:559)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.elasticsearch.ElasticsearchParseException: Failed to derive xcont
ent from org.elasticsearch.common.bytes.ChannelBufferBytesReference@b668d26f
at org.elasticsearch.common.xcontent.XContentFactory.xContent(XContentFa
ctory.java:279)
at org.elasticsearch.search.SearchService.parseSource(SearchService.java
:705)
... 9 more
[2015-07-29 17:29:48,276][DEBUG][action.search.type ] [Black Talon] [blog]
[0], node[7P3BV3fuTJqRwvvc3Wmcvw], [P], s[STARTED]: Failed to execute [org.elast
icsearch.action.search.SearchRequest@16ffd379] lastShard [true]
org.elasticsearch.search.SearchParseException: [blog][0]: from[-1],size[-1]: Par
se Failure [Failed to parse source [na]]
at org.elasticsearch.search.SearchService.parseSource(SearchService.java
:735)
at org.elasticsearch.search.SearchService.createContext(SearchService.ja
va:560)
at org.elasticsearch.search.SearchService.createAndPutContext(SearchServ
ice.java:532)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchServic
e.java:294)
at org.elasticsearch.search.action.SearchServiceTransportAction$5.call(S
earchServiceTransportAction.java:231)
at org.elasticsearch.search.action.SearchServiceTransportAction$5.call(S
earchServiceTransportAction.java:228)
at org.elasticsearch.search.action.SearchServiceTransportAction$23.run(S
earchServiceTransportAction.java:559)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.elasticsearch.ElasticsearchParseException: Failed to derive xcont
ent from org.elasticsearch.common.bytes.ChannelBufferBytesReference@b668d26f
at org.elasticsearch.common.xcontent.XContentFactory.xContent(XContentFa
ctory.java:279)
at org.elasticsearch.search.SearchService.parseSource(SearchService.java
:705)
... 9 more
[2015-07-29 17:29:48,280][DEBUG][action.search.type ] [Black Talon] All sh
ards failed for phase: [query]
org.elasticsearch.search.SearchParseException: [blog][4]: from[-1],size[-1]: Par
se Failure [Failed to parse source [na]]
at org.elasticsearch.search.SearchService.parseSource(SearchService.java
:735)
at org.elasticsearch.search.SearchService.createContext(SearchService.ja
va:560)
at org.elasticsearch.search.SearchService.createAndPutContext(SearchServ
ice.java:532)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchServic
e.java:294)
at org.elasticsearch.search.action.SearchServiceTransportAction$5.call(S
earchServiceTransportAction.java:231)


(Harpreet Bhatia) #2

so did you find anything on this. I am having same problem


(Isabel Drost-Fromm) #3

Not knowing a whole lot about what how exactly you are sending the query (or JavaScript in general for that matter): To me this looks like the query doesn't make it to Elasticsearch. Maybe this helps you: http://stackoverflow.com/questions/13144794/ajax-call-with-elasticsearch-search


(system) #4