Delete documents by filter #284
Replies: 15 comments 24 replies
-
I really would love to have the possibility to delete documents that have become obsolete, one of my cases uses random id:s (there is no unique identifier for the objects), and then I would like to delete the content that matches some criteria, and then update with new documents. |
Beta Was this translation helpful? Give feedback.
-
Hi, In our case, our customers generally has product table with is_active field and we only want to keep active products on the index. We also have last_update_time field in the index. They don't delete passive products from the table for reporting reasons. I know the best way is to send delta update but for most of the customers we have no ability to do that. We send active products to the index (not delta update we send all of them) and remove passive products. To remove passive products firstly we get last update starting date from our db then we send a search query to get productIds that has earlier last_update_time value than the last update starting date then we send delete requests to the index. If we had an ability to remove items by query it would be so much easier for us and other people to implement meili search on their system. Because the hardest part of the implementation for us is to keep the index up to date. |
Beta Was this translation helpful? Give feedback.
-
We use ElasticSearch today, and a common operation is to delete all records for a particular company-id. So basically, it's a multi-tenant app and when a customer account is deleted, we make a query to delete all records in the index that match the filter/facet, e.g. |
Beta Was this translation helpful? Give feedback.
-
My use case for this feature is for partial reindexing. In certain situations, we know that a subset of the index has gone out-of-sync, and the easiest solution is to delete all documents in the index that match a given filter (i.e. Why do we need to delete and not just update? Because a document that exists in the index might no longer exist in the database (this is what we consider going out-of-sync). |
Beta Was this translation helpful? Give feedback.
-
We are currently also using this for a project that is still running on ElasticSearch and is being converted to Meilisearch. We may import duplicate data from external suppliers and merge them. Here we could first remove all products with the same unique identifier so that everything is definitely gone and then create a record for the merged product. At the moment we fetch all IDs from MySQL and then delete the Meilisearch records by ID. |
Beta Was this translation helpful? Give feedback.
-
Hello all, I wanted to post about this, but I noticed it already existed! For me, I have an index of products, the same product can exist in multiple stores. Since I can't use the same ID in multiple documents, I set the document id to be [{ "id": "123/1", "product_id": 123, "store_id": 1 },
{ "id": "123/2", "product_id": 123, "store_id": 2 }] Now for my use-case, if I want to delete store 2 and all of its products, there is no way to fetch the products in that specific store, and so I would need to manually query all the products in that store and then do a batch delete, or perform a complete re-indexation. I would like if there was ability to perform filtering when deleting documents. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Hello everyone watching this discussion: we've created an issue on the Meilisearch repo about this feature meilisearch/meilisearch#2787 |
Beta Was this translation helpful? Give feedback.
-
We are using distinct fields on some indexes where there are multiple representations of a record. cc @dureuill (I guess you are implementing this in meilisearch/meilisearch#3477) |
Beta Was this translation helpful? Give feedback.
-
In the Cloudquery Meilisearch source plugin we weren't able to implement the The reason for this is that currently we would have to read all index documents and then delete the documents by UID (having parsed & checked the This feature would allow us filtering by |
Beta Was this translation helpful? Give feedback.
-
fyi, its in progress https://roadmap.meilisearch.com/c/103-delete-documents-by-filters |
Beta Was this translation helpful? Give feedback.
-
Hi everyone! 👋 😄 We wanted to give you an update on the status of this feature. We're currently working on a prototype (which will be available in the next few weeks) that will allow you to delete documents by |
Beta Was this translation helpful? Give feedback.
-
Hi everyone 👋 As promised, here's a 🧪 prototype that allows you to delete your documents by filter. How to get the prototype?Using docker, use the following command:
How to use the prototype?A new route is available under
It'll then enqueue a task in your task queue that'll delete all the documents matching this filter once it's processed.
You can also check out the original PR for more info
|
Beta Was this translation helpful? Give feedback.
-
Hello everyone 👋 We have just released the first RC (release candidate) of Meilisearch containing this new feature! docker run -it --rm -p 7700:7700 -v $(pwd)/meili_data:/meili_data getmeili/meilisearch:v1.2.0-rc.0 You are welcome to leave your feedback in this discussion. If you encounter any bugs, please report them here. 🎉 Official and stable release containing this change will be available on June 5th, 2023 |
Beta Was this translation helpful? Give feedback.
-
For the new document deletion by filter feature, does this perform any sort of batching to the task? e.g if the filter matches 1 million documents, will meilisearch attempt to batch these deletes? Or is the number of documents getting deleting in a single task not a concern? |
Beta Was this translation helpful? Give feedback.
-
Hey folks 👋 v1.2 has been released! 🐻❄️ You can now Get and Delete documents by filter. ✨ Note: Fields must be set as filterable before using them as filters. 📚 https://www.meilisearch.com/docs/reference/api/documents#delete-documents-by-filter |
Beta Was this translation helpful? Give feedback.
-
Hi everyone 👋
We would like your feedback about being able to delete documents matching the same filters.
How would you like to use it and for what purpose? Delete documents that have become obsolete? Delete documents that should not have been indexed?
Thanks for your feedback 😇
Beta Was this translation helpful? Give feedback.
All reactions