Java API updating index templates: script parse exception

Hi there,

Looking for some pointers or tips for upgrading elasticsearch. Currently under 1.4. I've been reading about the changes to mappings and the java API to upgrade to 2.1.

I'm following the conventions for sending the templates via the HTTP api to construct the source here:

Everything works when I send the generated string to the server directly. However, using the java API, I'm getting a strange exception with the same string:

ScriptParseException[unexpected field [settings]]

The java docs to update a template isn't very verbose. Am I missing something?

using "mustache" for the scriptlang as suggested there.


I was using the wrong functions. I copied from ES's test examples here. Was confused between 'scripts' and 'templates' as it's not entirely clear at first glance in the docs.