Elasticsearch data delete

Hi,

I want to delete my data on elasticsearch index.

my code:

POST titub2/ihale/_delete_by_query
{
  "query": { 
    "match": {
      "dosyaadi": "2014_06-08"
    }
  }
}

result:

{
      "_index": "titub2",
      "_type": "ihale",
      "_id": "_delete_by_query",
      "_version": 12,
      "_shards": {
        "total": 2,
        "successful": 1,
        "failed": 0
      },
      "created": false
    }

it can not be deleted. What is the problem?

Hi,

what is your Elasticsearch version ? This is a 5.0 feature.

@see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html

Bye,
Xavier

You just created a document called _delete_by_query.

My guess is that you are using elasticsearch 2.x and not 5.0, right?

If so, read: https://www.elastic.co/guide/en/elasticsearch/plugins/2.4/delete-by-query-usage.html

Yes E.S. 2.4.1.

I installed plugin delete_by_query :sudo bin/plugin install delete-by-query

and my code:

DELETE /titub2/ihale/_query
{
  "query": { 
    "term": {
      "dosyaadi": "2014_06-08"
    }
  }
}

result:

{
  "took": 0,
  "timed_out": false,
  "_indices": {
    "_all": {
      "found": 0,
      "deleted": 0,
      "missing": 0,
      "failed": 0
    }
  },
  "failures": []
}

it could not be deleted. How can I do?

You must search matching documents, and then delete one by one per document ID , using the Bulk will be the better solution.

@see https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-bulk.html

Your date is incorrect.

'dosyaadi' is not date. It is a file name actullay So It is string data type

What gives the following?

GET titub2/ihale/_search
{
  "query": { 
    "term": {
      "dosyaadi": "2014_06-08"
    }
  }
}

I did:

DELETE /titub2/ihale/_query?q=dosyaadi:2014_06-08

It works true.

Thank you.