title: Delete all index except one/some in Elasticsearch?
body: <p>Is there any way to delete all indices except one?</p>
  
  <p>We can use the metadata <strong>_index</strong> of document in a <strong>GET</strong> request:</p>
  
  <pre><code>GET _count
  {
    "query": {
      "match": {
        "_index": "indexname"
      }
    }
  }
  </code></pre>
  
  <p>The above query doesn't make sense but just to show that we can use <strong>_index</strong> inside a query I have mentioned it.  </p>
  
  <p>I have tried the below query, but I guess <strong>_all</strong> API doesn't support query. </p>
  
  <pre><code>DELETE _all
  {
    "query" : {
    "bool" : {
     "must_not" : [
       {
         "match": {
           "_index": "indexname"
         }
       }
     ]
    }
   }
  }
  </code></pre>
  
  <p>Is there any way to delete all indices except one/some without using bulk API ?</p>