How to delete bunch of documents by list of ids

Is it possible to delete list of documents by list of documents id?

i tryed like this but it does not work at all
deleteAllByIdIn(List<UUID> ids); from ElasticsearchRepository and it does not work at all please guid me, maybe providing a query impelemntation please?


This seems like a spring data related question and not really elasticsearch.

In elasticsearch, it's good to delete documents using the delete API or better the bulk API if you have a lot of them to delete.

1 Like

Thank you very much, could you please provide a solution of how to do it using bulk API?

this is how my data looks like

   "work":"software dev",
   "work":"software engi",

i need to delete all ids which its expirationDate before today`date are

Then you don't want to provide a list of ids but a query, right?

And use this API?

Better solution is to use time based indices and simply drop the older indices everyday.
Which can be automated with ILM:

Thanks, but i need a code using spring and not sending bunch of queries, where can i find such a code example please ? using QueryBuilder, can you provide me a code example about my case please? using QueryBuilder in springboot

Not sure it will answer your question but here is some code which uses Spring Boot (not Spring Data Elasticsearch) where I'm building

A BulkProcessor:

Delete documents by id:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.