"}" +
"}").get();
assertEquals(scriptResponse.getVersion(), 2);
GetIndexedScriptResponse getResponse = client().prepareGetIndexedScript("mustache", "testTemplate").get();
assertTrue(getResponse.isExists());
List<IndexRequestBuilder> builders = new ArrayList<>();
builders.add(client().prepareIndex("test", "type", "1").setSource("{\"theField\":\"foo\"}"));
builders.add(client().prepareIndex("test", "type", "2").setSource("{\"theField\":\"foo 2\"}"));
builders.add(client().prepareIndex("test", "type", "3").setSource("{\"theField\":\"foo 3\"}"));
builders.add(client().prepareIndex("test", "type", "4").setSource("{\"theField\":\"foo 4\"}"));
builders.add(client().prepareIndex("test", "type", "5").setSource("{\"theField\":\"bar\"}"));
indexRandom(true,builders);
Map<String, String> templateParams = Maps.newHashMap();
templateParams.put("fieldParam", "foo");
SearchResponse searchResponse = client().prepareSearch("test").setTypes("type").
setTemplateName("testTemplate").setTemplateType(ScriptService.ScriptType.INDEXED).setTemplateParams(templateParams).get();
assertHitCount(searchResponse, 4);
DeleteIndexedScriptResponse deleteResponse = client().prepareDeleteIndexedScript("mustache","testTemplate").get();
assertTrue(deleteResponse.isFound());
getResponse = client().prepareGetIndexedScript("mustache", "testTemplate").get();
assertFalse(getResponse.isExists());
client().prepareSearch("test").setTypes("type").
setTemplateName("/template_index/mustache/1000").setTemplateType(ScriptService.ScriptType.INDEXED).setTemplateParams(templateParams).get();
}