title: How to remove all documents of type from elasticsearch index version 2.2
body: <p>I'm trying to remove all documents of a specific type using the nodejs client for elastic search.</p>
  
  <p>I have this code: </p>
  
  <pre><code>var deleteType = function (type, done) {
      client().indices.delete({
        "index": settings.index,
        "type": type,
        "ignore": [404]
      }, function (error, response) {
        if (error) {
          logger.error(error, 'Failed to delete index type');
          done(error);
        } else {
          logger.debug({"res": response}, "deleted %s index", type);
          done();
        }
      });
    };
  </code></pre>
  
  <p>The type and index parameters are fine. But it seems to be deleting the entire index, not just docs of that type. I'm guessing that I've made the wrong API call with <code>indices.delete</code>.</p>
  
  <p>What is the right way to delete all documents of a specific "type" within an index?</p>