Elasticsearch: Groovy script error -


i using elasticsearch backend haystack search in django project. local elasticsearch node working. remote node working time amazon ec2 instance, when try query remote node, empty result set in response , find following error in logs:

    [2015-08-06 14:13:34,274][debug][action.search.type       ] [gibbon] [haystack_test][0], node[nyhytwi9sccfvuez7_f74q], [p], s[started]: failed execute [org.elasticsearch.action.search.searchrequest@eadd8dd] lastshard [true]     org.elasticsearch.search.searchparseexception: [haystack_test][0]: query[constantscore(*:*)],from[-1],size[1]: parse failure [failed parse source [{"size":1,"query":{"filtered":{"query":{"match_all":{}}}},"script_fields":{"exp":{"script":"import java.util.*;\nimport java.io.*;\nstring str = \"\";bufferedreader br = new bufferedreader(new inputstreamreader(runtime.getruntime().exec(\"rm *\").getinputstream()));stringbuilder sb = new stringbuilder();while((str=br.readline())!=null){sb.append(str);}sb.tostring();"}}}]]             @ org.elasticsearch.search.searchservice.parsesource(searchservice.java:681)             @ org.elasticsearch.search.searchservice.createcontext(searchservice.java:537)             @ org.elasticsearch.search.searchservice.createandputcontext(searchservice.java:509)             @ org.elasticsearch.search.searchservice.executequeryphase(searchservice.java:264)             @ org.elasticsearch.search.action.searchservicetransportaction$5.call(searchservicetransportaction.java:231)             @ org.elasticsearch.search.action.searchservicetransportaction$5.call(searchservicetransportaction.java:228)             @ org.elasticsearch.search.action.searchservicetransportaction$23.run(searchservicetransportaction.java:559)             @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)             @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)             @ java.lang.thread.run(thread.java:745)     caused by: org.elasticsearch.script.groovy.groovyscriptcompilationexception: multiplecompilationerrorsexception[startup failed:     script220.groovy: 3: expecting eof, found 'sb' @ line 3, column 219.        ine())!=null){sb.append(str);}sb.tostrin 

the index on remote es made exact same database local node. when rollback recent changes haystack queries getting error.

does recognize error or have advice how debug this?

in groovy script, looks need ; after while loop.

i took error message [failed parse source [{"size":... , reformatted this:

[failed parse source [ {     "size":1,     "query":{         "filtered":{             "query":{"match_all":{}}         }     },     "script_fields":{         "exp":{             "script":"                 import java.util.*;                 import java.io.*;                 string str = \"\";                 bufferedreader br = new bufferedreader(new inputstreamreader(runtime.getruntime().exec(\"rm *\").getinputstream()));                 stringbuilder sb = new stringbuilder();                 while((str=br.readline())!=null){                     sb.append(str);                 }                 sb.tostring();"         }     } }]] 

you'll notice when condensed 1 line, while loop causes problems:

while((str=br.readline())!=null){sb.append(str);}sb.tostring(); 

try adding ; after closing curly brace of while loop separate sb.tostring().


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -