title: putMapping elasticsearch index not found exception
body: <p>I am just trying to create an index using putMapping and am fairly certain this is a syntax issue. The elastic client is working for .index and .search commands, so I do not believe the setup of it is the issue. Rather it is something with my putmapping code. Any suggestions would be much appreciated. A little description of what I am trying to do. I have searched an index, and found that it does not exist. I catch the error and test to see if it equals "index_not_found_exception". If so, I need to create the index. Everything below the "..." is inside the .catch.</p>
  
  <pre><code>"use strict";
  let config = require("./config"),
      soap = require("soap"),
      elastic = require("elasticsearch").Client(config.routeHost);
  ...
   if (error.body.error.type == "index_not_found_exception") {
          console.log("no index");
          elastic.indices.putMapping({
              index: "ppvevents",
              type: "ppvObject",
              body: {
                  properties: {
                      name: {type: "string", index: "not_analyzed"},
                      hdid: {type: "integer"},
                      sdid: {type: "integer"}
                  }
              }
          }).then(function(response){
              console.log("Response: ", response);
          }).catch(function(error){
              console.log("putMapping Error: ", error);
          });
      } else if(error.body.error.type != "index_not_found_exception") {
          console.log("error: elasticsearch client search");
          console.log(error);
      }
  </code></pre>
  
  <p>The console response is below:</p>
  
  <pre><code>vagrant at localhost in /vagrant on master!
  ± node index.js
  9000
  no index
  putMapping Error:  { [Error: [index_not_found_exception] no such index, with { resource.type=index_or_alias resource.id=ppvevents index=ppvevents }]
      status: 404,
      displayName: 'NotFound',
      message: '[index_not_found_exception] no such index, with { resource.type=index_or_alias resource.id=ppvevents index=ppvevents }',
      path: '/ppvevents/_mapping/ppvObject',
      query: {},
      body:
          { error:
              { root_cause: [Object],
                  type: 'index_not_found_exception',
                  reason: 'no such index',
                  'resource.type': 'index_or_alias',
                  'resource.id': 'ppvevents',
                  index: 'ppvevents' },
              status: 404 },
          statusCode: 404,
          response: '{"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"ppvevents","index":"ppvevents"}],"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"ppvevents","index":"ppvevents"},"status":404}',
  toString: [Function],
  toJSON: [Function] }
  </code></pre>