# Javascript and index templates

**URL:** <https://discuss.elastic.co/t/javascript-and-index-templates/287940>\
**Category:** Elasticsearch\
**Created:** [October 28, 2021, 4:08pm UTC](https://discuss.elastic.co/t/javascript-and-index-templates/287940 "2021-10-28T16:08:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tamis-laan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tamis-laan/32/96473_2.png) [@tamis-laan](https://discuss.elastic.co/u/tamis-laan)\
**Post date:** [October 28, 2021, 4:08pm UTC](https://discuss.elastic.co/t/javascript-and-index-templates/287940/1 "2021-10-28T16:08:18Z")

</div>

I'm trying to create an index template as followed:

```javascript
client.indices.putTemplate({name:"loctmplt", body: {
 index_patterns: ['*'],
  template: {
    mappings: {
      properties: {
        location: {
          properties: {
            coordinates: {
              type: "geo_point",
              ignore_malformed: false,
              ignore_z_value: true
            }
          }
        }
      }
    }
  }
}}).then( res => console.log(res), err => console.error(err))

```

This creates an empty legacy index template, how do I create a modern working index template? Information about this is difficult to find.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 28, 2021, 4:28pm UTC](https://discuss.elastic.co/t/javascript-and-index-templates/287940/2 "2021-10-28T16:28:27Z")

</div>

I did not check but I'd expect another method for this like `putIndexTemplate`.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 25, 2021, 4:28pm UTC](https://discuss.elastic.co/t/javascript-and-index-templates/287940/3 "2021-11-25T16:28:54Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
