0

In older Elasticsearch version I simple do the following to delete data:

curl -XDELETE 127.0.0.1:9200/what/ever/_search?q=keyword

Now in Elasticsearch 6.X it's no longer supported. I had to use delete_by_query feature.

According to the document, it seems like I can't use querystring there anymore, any ideas?

P.S

I need to match any fields, but the example query provided online matches a specific field, e.g

{
  "query": { 
    "match": {
      "message": "some message"
    }
  }
}
1

1 Answer 1

2

The Delete by Query API still supports a query in the query string, you just have to use POST instead of DELETE and the _delete_by_query endpoint:

curl -XPOST 127.0.0.1:9200/what/ever/_delete_by_query?q=keyword

Otherwise you can also you a query_string within the body, like this:

curl -XPOST 127.0.0.1:9200/what/ever/_delete_by_query -d '{
  "query": { 
    "query_string": {
      "query": "keyword"
    }
  }
}'
Sign up to request clarification or add additional context in comments.

1 Comment

Are you trying to match the message field instead of all fields?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.