Elasticsearch 2.2: delete documents by query
<p>I am trying to delete some documents from Elasticsearch.</p>

<p>I have these requests:</p>

<pre><code>IDX=logstash-2016.02.13

curl -XGET "http://localhost:9200/$IDX/fg400/_search" -d '{
  "query" : {
    "term" : {
      "action" : "start"
    }
  }
}' | python -m json.tool
</code></pre>

<p>This read query gives:    </p>

<pre><code>{
    "_shards": {
        "failed": 0,
        "successful": 5,
        "total": 5
    },
    "hits": {
        "hits": [
            {
                "_id": "AVLcXJrLLFxTvjNEoqDO",
                "_index": "logstash-2016.02.13",
                "_score": 3.4307306,
                "_source": {
                    "@timestamp": "2016-02-13T20:40:00.000Z",
                    "@version": "1",
                    "action": "start",   &lt;------
...
        ],
        "max_score": 3.4307306,
        "total": 146511
    },
    "timed_out": false,
    "took": 13
}
</code></pre>

<p>Now I say this because I want to DELETE some:</p>

<pre><code>curl -XDELETE "http://localhost:9200/${IDX}/fg400/_query" -d '{
  "query" : {
    "term" : {
        "action" : "start"
    }
  }
}' | python -m json.tool
</code></pre>

<p>And this gives the following output:</p>

<pre><code>{
    "_id": "_query",
    "_index": "logstash-2016.02.13",
    "_shards": {
        "failed": 0,
        "successful": 1,
        "total": 2
    },
    "_type": "fg400",
    "_version": 1,
    "found": false
}
</code></pre>

<p>Why can't I delete what I found in the first place before using GET?</p>