ohadinho
ohadinho

Reputation: 7144

Elasticsearch 2.3 - delete documents by query

I'm using elasticsearch 2.3 & Sense and trying to delete documents by query.

I refer to these docs: https://www.elastic.co/guide/en/elasticsearch/plugins/current/delete-by-query-usage.html

Request

DELETE /monitors/monitor/_query
{
  "term": { "ProcessName" : "myProcName" }
}

Response

{
  "found": false,
  "_index": "monitors",
  "_type": "monitor",
  "_id": "_query",
  "_version": 11,
  "_shards": {
    "total": 2,
    "successful": 1,
    "failed": 0
  }
}

As you can see, i'm not getting any results even though I have ProcessName named "myProcName". Response also tells that the engine looks for _id equals to _query.

EDIT 1: Even when sending request:

DELETE /monitors/monitor/_query
{
  "query": {
    "term": { "ProcessName" : "tibapp_qflowfile" }
  }
}

I'm getting response:

{
  "found": false,
  "_index": "monitors",
  "_type": "monitor",
  "_id": "_query",
  "_version": 1,
  "_shards": {
    "total": 2,
    "successful": 1,
    "failed": 0
  }
}

Upvotes: 1

Views: 4716

Answers (2)

Brian
Brian

Reputation: 87

FYI - The Plugin [delete-by-query] is incompatible with Elasticsearch [2.3.5]. Was designed for version [2.3.4]

Upvotes: 1

Val
Val

Reputation: 217274

The output you're getting means that you haven't installed the delete-by-query plugin, which isn't installed by default.

Do that first, restart your node and it will work afterwards

bin/plugin install delete-by-query

Upvotes: 2

Related Questions