FronterAS/elasticsearch-wrapper — pull request #1 by freshteapot (2014-01-23 12:49:51+00:00)
Title: Added a function to allow for adding / updating a template.

Adding a simple wrapper to allow us to add or replace an existing "_template".

Example usage:
```
var config = require('../config'),
DB = require('elasticsearch-wrapper'),

fs = require('fs'),
name = 'test_template',
template = fs.readFileSync('./templates/template.json', {
encoding: 'utf8'
});

DB.config(config);
DB.createTemplate(name, template);
```
Then to see it:
```
curl -XGET 'http://localhost:9200/_template/test_template?pretty=true'
```

Useful urls:

* http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-indices-puttemplate
* http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html