<p>I am using Nodejs to index some data into Elasticsearch(hosted on kubernetes),I am using <code>client.create()</code> method to index document in Elasticsearch. If I run the code on localhost and kubernetes Elasticsearch endpoint, Everything is working fine. But after deploying the same code when I tried indexing a document, I am getting an error:</p>

<blockquote>
  <p>"[invalid_type_name_exception] Document mapping type name can't start
  with '_', found: [_create] :: {"path":"/index_name/_create/docId"]".</p>
</blockquote>

<p>Elasticsearch version "6.3.0" and node_module version "^16.0.0".
Also, it was working initially but stopped working from past few days.
I think the issue is with some compatibility and configurations, can anyone please help?</p>

<p>I tried using client.index instead of client.create and it works fine.
i already matched all configuration and compatibility files on local and server. Everything seems OK to me.</p>

<pre><code>const elasticsearchDoc = {
      index: "school",
      type: "_doc",
      id: 12345,
      body: { name:"raj",marks:40 }
};
const result = await client.create(elasticsearchDoc);
...
</code></pre>

<p>I think the problem is that you're using the <a href="https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/16.x/index.html" rel="noreferrer">old JS client</a> library instead of <a href="https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html" rel="noreferrer">the new one</a>. </p>

<p>With 16.0.0 you need <a href="https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/16.x/configuration.html#config-options" rel="noreferrer">to explicitely set the <code>apiVersion</code> parameter</a> to the 6.x version because 7.0 is the default and that's probably why you're seeing this error (since you're using ES 6.3.0):</p>

<pre><code>apiVersion: 6.7
</code></pre>
