Failed to find action [org.elasticsearch.script.mustache.SearchTemplateAction@76440dba] to execute

Im getting below exception when im trying to use mustache template.

failed to find action [org.elasticsearch.script.mustache.SearchTemplateAction@76440dba] to execute

Please share the template and the entire error you are seeing.

Hi please find below template and im not able to see any logs apart from this.

{

"script": {

    "lang": "mustache",

    "source": "{\"query\":{\"bool\":{\"should\":[{\"{{#orFields}}nested\":{\"path\":\"{{path}}\",\"query\":{\"terms\":{\"{{path}}.{{key}}.{{key}}_keyword\":[\"{{#toJson}}values{{\/toJson}}\"]}}}},{\"{{\/orFields}}bool\":{\"must_not\":{\"terms\":{\"mock\":[\"mock\"]}}}}],\"must\":[{\"{{#andFields}}nested\":{\"path\":\"{{path}}\",\"query\":{\"terms\":{\"{{path}}.{{key}}.{{key}}_keyword\":[\"{{#toJson}}values{{\/toJson}}\"]}}}},{\"{{\/andFields}}{{#rangeFields}}range\":{\"processInstrumentCreatedDate\":{\"{{#from}}gte\":\"{{from}}{{#to}}\",\"{{\/to}}{{\/from}}{{#to}}lte\":\"{{to}}{{\/to}}\"}}},{\"{{\/rangeFields}}bool\":{\"must_not\":{\"terms\":{\"mock\":[\"mock\"]}}}}]}},\"{{#pageFields}}{{#page_size}}size\":\"{{page_size}}{{\/page_size}}\",\"from{{#page_from}}\":\"{{page_from}}{{\/page_from}}\",\"{{\/pageFields}}sort\":[{\"{{#sortFields}}{{sortKey}}\":{\"order\":\"{{sortOrder}}\",\"nested\":{\"path\":\"{{sortPath}}\"}}}],\"{{\/sortFields}}_source\":{\"includes\":[\"{{#include_path}}\",\"{{.}}\",\"{{\/include_path}}\"],\"excludes\":[\"{{#exclude_path}}\",\"{{.}}\",\"{{\/exclude_path}}\"]}{{#isSearch}},\"search_after\":[{{#join}}search_after{{\/join}}]{{\/isSearch}}}"

}

}

Also if I dont delete lang-mustache from module folder and place those jar in lib folder i'm getting below error.

java.lang.NoClassDefFoundError: org/elasticsearch/script/mustache/SearchTemplateRequestBuilder
at com.wipro.basenxt.search.core.query.QueryTemplateAdapter.adapt(QueryTemplateAdapter.java:29)
at com.wipro.basenxt.search.core.query.QueryExecEngine.execute(QueryExecEngine.java:49)
at com.wipro.basenxt.search.core.rest.QueryProcessor.getResult(QueryProcessor.java:35)
at com.wipro.basenxt.search.core.rest.AbstractRestHandler.prepareRequest(AbstractRestHandler.java:110)
at org.elasticsearch.rest.BaseRestHandler.handleRequest(BaseRestHandler.java:94)
at org.elasticsearch.xpack.security.rest.SecurityRestFilter.handleRequest(SecurityRestFilter.java:81)
at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:236)
at org.elasticsearch.rest.RestController.tryAllHandlers(RestController.java:318)
at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:176)
at org.elasticsearch.http.AbstractHttpServerTransport.dispatchRequest(AbstractHttpServerTransport.java:318)
at org.elasticsearch.http.AbstractHttpServerTransport.handleIncomingRequest(AbstractHttpServerTransport.java:372)
at org.elasticsearch.http.AbstractHttpServerTransport.incomingRequest(AbstractHttpServerTransport.java:308)
at org.elasticsearch.http.netty4.Netty4HttpRequestHandler.channelRead0(Netty4HttpRequestHandler.java:42)
at org.elasticsearch.http.netty4.Netty4HttpRequestHandler.channelRead0(Netty4HttpRequestHandler.java:28)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at org.elasticsearch.http.netty4.Netty4HttpPipeliningHandler.channelRead(Netty4HttpPipeliningHandler.java:58)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)

Please format your code/logs/config using the </> button, or markdown style back ticks. It helps to make things easy to read which helps us help you :slight_smile:

But what i see from code is that issue is with mustache jar because same thing is working in 7.0.0 but not working in 7.9.0.

Can you please tell me if i need to change anything particular to 7.9.0

I have a custom plugin which uses mustache and i have upgarded both plugin and ES to 7.9.0 from 7.0..0.

After upgrading im not able to query using mustache.

I have placed lang-mustache-client-7.9.0.jar to libs and deleted lang-mustache folder from modules.But im getting below error.

TenantNull failed to find action [org.elasticsearch.script.mustache.SearchTemplateAction@76440dba] to execute

Same works in 7.0.0

Can u please help

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.