Recently, I upgraded from Elasticsearch 1.6.2 to 2.3.1. Indexed Search templates containing "fields" and "size" fail to get indexed into .scripts due to ScriptParseException.
Example template:
{
"size":"{{my_size}}",
"fields":["my_field"],
"query" : {
"filtered" : {
"filter" : [
{ "term" : { "my_term": "{{my_term}}" }}
]
}
}
}
Exception:
ScriptParseException[unexpected field [_size]]
at org.elasticsearch.script.AbstractScriptParser.parse(AbstractScriptParser.java:107)
at org.elasticsearch.script.Template.parse(Template.java:139)
at org.elasticsearch.index.query.TemplateQueryParser.parse(TemplateQueryParser.java:108)
at org.elasticsearch.script.ScriptService.validate(ScriptService.java:361)
at org.elasticsearch.script.ScriptService.putScriptToIndex(ScriptService.java:394)
at org.elasticsearch.action.indexedscripts.put.TransportPutIndexedScriptAction.doExecute(TransportPutIndexedScriptAction.java:51)
at org.elasticsearch.action.indexedscripts.put.TransportPutIndexedScriptAction.doExecute(TransportPutIndexedScriptAction.java:37)
at org.elasticsearch.action.support.TransportAction.doExecute(TransportAction.java:149)
at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:137)
at org.elasticsearch.action.support.HandledTransportAction$TransportHandler.messageReceived(HandledTransportAction.java:61)
at org.elasticsearch.action.support.HandledTransportAction$TransportHandler.messageReceived(HandledTransportAction.java:51)
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:75)
at org.elasticsearch.transport.netty.MessageChannelHandler.handleRequest(MessageChannelHandler.java:245)
at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:114)
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
at org.elasticsearch.common.netty.OpenChannelsHandler.handleUpstream(OpenChannelsHandler.java:75)
Same exception is applicable for fields too - ScriptParseException[unexpected field [_fields]].
Any thoughts on how to resolve this?