PutIndexTemplateRequest putRequest = new PutIndexTemplateRequest(request.param("name"));
try {
putRequest.create(request.paramAsBoolean("create", false));
putRequest.cause(request.param("cause", ""));
putRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
// parse the parameters
Map<String, Object> source = XContentFactory.xContent(request.contentByteArray(), request.contentByteArrayOffset(), request.contentLength())
.createParser(request.contentByteArray(), request.contentByteArrayOffset(), request.contentLength()).mapAndClose();