title: Cannot add data into elastic using axios from nodejs
body: <p>I am trying to import data into elastic search using axios and nodejs but I am getting 400 bad request error, I have created index in elastic which is sales-enable-data index I am trying to add data using that index but I am getting bad request error</p>
  <p><strong>Code</strong></p>
  <pre><code>  app.get(&quot;/import/data&quot;, async (req, res) =&gt; {
  
      const current = {
      project_name: &quot;java&quot;,
      delivery_manager: &quot;Yawhe&quot;,
      project_manager: &quot;Ruth&quot;,
      };
      const data = JSON.stringify(current);
  
      await axios({
         url: &quot;http://localhost:9200/sales-enable-data-index/_doc&quot;,
         method: &quot;POST&quot;,
         headers: {
           &quot;Content-Type&quot;: &quot;application/json&quot;,
         },
         auth: {
           username: &quot;username&quot;,
           password: &quot;password&quot;,
         },
         body: data,
       })
          .then((response) =&gt; {
            return res.status(200).send(response);
         })
          .catch((err) =&gt; {
            return res.status(500).send(err);
         });
     });
  </code></pre>
  <p><strong>Error</strong></p>
  <pre><code>&quot;code&quot;: &quot;ERR_BAD_REQUEST&quot;,
  &quot;status&quot;: 400
  </code></pre>