title: Elastic Search Node.js client - Routing Error
body: <p>We have elastic hosted on GCP.  I'm getting an error when I try to simply post a document.  I'm using their node.js package, and I'm stuck with the following error:</p>
  <pre><code>PS C:\Projects\foo&gt; node --experimental-modules --unhandled-rejections=strict app.js
  (node:19356) ExperimentalWarning: The ESM module loader is experimental.
  (node:19356) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time
  Posting to Elastic =&gt; 5f91dfb0c64004000aab6c9b
  C:\Projects\foo\node_modules\@elastic\elasticsearch\lib\Transport.js:257
            const error = new ResponseError(result)
                          ^
  
  ResponseError: Response Error
      at IncomingMessage.&lt;anonymous&gt; (C:\Projects\foo\node_modules\@elastic\elasticsearch\lib\Transport.js:257:25)
      at IncomingMessage.emit (events.js:323:22)
      at endReadableNT (_stream_readable.js:1204:12)
      at processTicksAndRejections (internal/process/task_queues.js:84:21) {
    name: 'ResponseError',
    meta: {
      body: { error: 'Routing Error. The path you have requested is invalid.' },
      statusCode: 404,
      headers: {
        'content-type': 'application/json;charset=utf-8',
        server: 'Jetty(9.4.30.v20200611)',
        'x-cloud-request-id': 'srCq9DMFQVWuGsdXxgWhjA',
        'x-content-type-options': 'nosniff',
        'x-found-handling-cluster': '[Removed]',
        'x-found-handling-instance': 'instance-0000000001',
        'x-frame-options': 'SAMEORIGIN',
        'x-request-id': 'a2696b33-e4dc-4dfc-a8b1-f7ec17906ff7',
        'x-runtime': '0.010689',
        'x-xss-protection': '1; mode=block',
        date: 'Mon, 09 Nov 2020 21:28:28 GMT',
        'content-length': '66'
      },
      meta: {
        context: null,
        request: [Object],
        name: 'elasticsearch-js',
        connection: [Object],
        attempts: 0,
        aborted: false
      }
    }
  }
  </code></pre>
  <p>I have the client set up as follows</p>
  <pre><code>   const client = new Client({
          node: 'https://[REMOVED].ent-search.us-central1.gcp.cloud.es.io',
          auth: {
            apiKey: 'Bearer private-[REMOVED]'
          }
      });
  
  </code></pre>
  <p>Then I attempt to send a json file as an array to Elastic.</p>
  <pre><code>    client.helpers.bulk({
      datasource: posts,
      onDocument(doc) {
        return {
          create: {_index: 'my-index', _id: elasticPost.id}
        };
       }
     });
  
  </code></pre>
  <p>Update:</p>
  <p><em><strong>The JSON names MUST be lowercase.</strong></em>  For example:</p>
  <p>Doesn't Work:</p>
  <pre><code>{
     &quot;Id&quot;:  123456
  }
  </code></pre>
  <p>Works:</p>
  <pre><code>{
     &quot;id&quot;: 123456
  }
  
  </code></pre>
  <p>Another thing may have to do with needing the cloud ID from Elastic, I'm not sure if this is required as well, but the lowercase allowed me to upload our document directly into Elastic.</p>