As the elasticsearch version 5 splits the jars into to different module. When we try to execute a search template not able to set the Template in the SearchRequestBuilder. What are the jars required for executing a search template. The searchTemplate has QueryString what would be the best approach to execute the query ?
For Ex: This is my search template
{
"template":{"query":{"query_string":{"query":"((cust _nme_new\"{{name}}\")^50 OR (ceo_Name:({{name}}))^30
}}
Please format your code using </> icon. It will make your post more readable.
You did not mention your error but I guess it's all about MustacheScriptEngineService.NAME? Am I correct?
I don't believe you need to add anything on the client side as the client does not do any transformation but just pass the query to the coordinating node.
Error we are getting :
Failed to execute phase [query_fetch], all shards failed; shardFailures {[IhhQQOkrSaKlWju_L_ZRNg][twitter][0]: RemoteTransportException[[IhhQQOk][127.0.0.1:9300][indices:data/read/search[phase/query+fetch]]]; nested: ParsingException[no [query] registered for [query]]; }org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1033)
at org.elasticsearch.transport.TransportService$6.onFailure(TransportService.java:559)
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.onFailure(ThreadContext.java:490)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:39)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: RemoteTransportException[[IhhQQOk][127.0.0.1:9300][indices:data/read/search[phase/query+fetch]]]; nested: ParsingException[no [query] registered for [query]];
Caused by: ParsingException[no [query] registered for [query]]
We are getting response for the above query by removing the template key from the query. After that we tried this query
"{\n" +
" "query" : {\n"+
"(("cust nmenew":"{{param_gender}}") AND ("ceo_Name":"{{param_gender}}"))" +
" }\n" +
"}"
We are getting error
UncategorizedExecutionException[Failed execution]; nested: IOException[Unexpected character ('(' (code 40)): was expecting double-quote to start field name
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.