title: Elasticsearch NodeJs putIndexTemplate API
body: <p>I'm using elasticsearch 7.13.3 and I want to call the <a href="https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#_indices_putindextemplate" rel="nofollow noreferrer">put index template API</a> from my typescript app. I'm using the package <code>&quot;@elastic/elasticsearch&quot;: &quot;7.13.0&quot;</code> but I get error for the composition of the call.</p>
  <p>From kibana I can execute without any error:</p>
  <pre><code>PUT _component_template/template-xxx2
  {
    &quot;template&quot;: {
      &quot;mappings&quot;: {
        &quot;properties&quot;: {
          &quot;@timestamp&quot;: {
            &quot;type&quot;: &quot;date&quot;
          },
          &quot;id&quot;: {
            &quot;type&quot;: &quot;keyword&quot;
          },
          &quot;value&quot;: {
            &quot;type&quot;: &quot;double&quot;,
            &quot;coerce&quot;: false
          }
        }
      }
    }
  }
  
  PUT _index_template/index-template-xxx2
  {
    &quot;index_patterns&quot;: [&quot;template-xxx2*&quot;],
    &quot;template&quot;: {
      &quot;settings&quot;: {
        &quot;number_of_shards&quot;: 2
      },
      &quot;mappings&quot;: {
        &quot;_source&quot;: {
          &quot;enabled&quot;: true
        },
        &quot;properties&quot;: {
          &quot;created_at&quot;: {
            &quot;type&quot;: &quot;date&quot;,
            &quot;format&quot;: &quot;EEE MMM dd HH:mm:ss Z yyyy&quot;
          }
        }
      },
      &quot;aliases&quot;: {
        &quot;mydata&quot;: { }
      }
    },
    &quot;priority&quot;: 600,
    &quot;composed_of&quot;: [&quot;template-xxx2&quot;], 
    &quot;version&quot;: 3,
    &quot;_meta&quot;: {
      &quot;description&quot;: &quot;template-xxx2 description&quot;
    }
  }
  </code></pre>
  <p>and I want do the same from my node app.
  The template creation it's ok:</p>
  <pre><code>void this.db.clientDb.indices.putTemplate({
    name: `template_${this.index}`,
    body: {
      mappings: {
        properties: {
          '@timestamp': {
            type: 'date'
          },
          id: {
            type: 'keyword'
          },
          value: {
            type: 'double',
            coerce: false
          }
        }
      }
    }
  });
  </code></pre>
  <p>But I can't find the correct overload for the <code>this.db.clientDb.indices.putIndexTemplate({</code> API.</p>
  <p><strong>This gave me errors:</strong> (no overloads match this call)</p>
  <pre><code>void this.db.clientDb.indices.putIndexTemplate({
    name: '',
    index_patterns: [&quot;template-xxx2*&quot;], // --&gt; where should I put this property?
    body: {
      settings: {
        number_of_shards: 2
      },
      mappings: {
        _source: {
          enabled: true
        }
      },
      aliases: {
        mydata: {}
      }
    },
    priority: 500,
    composed_of: ['template-xxx2'], // --&gt; where should I put this property?
    version: 3,
    _meta: {
      description: 'template-xxx2 description'
    }
  });
  </code></pre>
  <p>I want to do <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index-templates.html" rel="nofollow noreferrer">this latest script.</a></p>