-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Meilisearch crashes when using a lot of filter clauses #2163
Comments
Ok, so there are two things. Second, since you’re supposed to be getting an error, we can consider this:
As a feature request, you are currently limited to a certain amount of terms in your filters. One fix we thought would be to create an
That would make your request appear as one operation and thus work. You can read more about it here. Now on another note, I’m wondering, isn't there a better way to do it? |
Ok i guess if there is no IN option, or the filters are limited to a max length, we can not use this search engine for our company in production. I really love Meilisearch, but it doesn't look quite finished yet (it isn't ofc, there is no v1.0). Keep me posted when you guys are ready with an IN function that can have a couple thousand of id's.
I don't know how; we use have a large database with milions of records; just look at this example: Users table:
Relation table:
Invoices table:
So John can see 3 invoices. But i dont want to include john user id in the invoices table. The whole system is based on the idea of something is owned by a relation (beteen 2 users). So i need a query like: `SELECT id, name FROM invoices WHERE relation = 1 OR relation = 2) ... but some users have thousands of relations. We are now using Elasticsearch, and that is working. But its very complicated, and not supported by Laravel 9 (with the current package we are using). |
In reality the filter are limited to a certain depth. And each time you write a |
@irevoire In the time-beeing i have found a solution to our problem. Its is so easy that it is almost stupid i did not think about it haha. But i can ofcourse always add extra fields during the indexing of documents. I can just add a This problem can only be solved if a fix amount of users (in our case 2 users: the person who owns a relation, and who is connected) can be add in our index. If a document can be viewed by a dynamic group of lets say 50 users, its no good option to add extra user_id in the indexes. |
Hi @martijnderidder, indeed Meilisearch is not based on a relationship model. It forces to denormalize the SQL structure in some way. The most direct solution I see would be to deport the many-to-many relationship on each invoice document by integrating an array of user ids that would have access to it. e.g this way, if Does your many-to-many relationship only accept two users per invoice? |
@gmourier this is not a good idea, adding a new user requires re-indexing the database, and this is very inefficient storagewise |
This is true. Thats why i already was warning that this solution can only be used with a fix amount of users that can be viewed. So when you add the document, you already know wich users this document can be viewed. |
I'm also interested in an IN filter as I'm now forced to limit them (e.g. pick 500 IDs). For now I'm using a hybrid solution; SQL for making lists and Meili when doing filtering with limited results. |
Hello everyone here. I see two concerns
I close this issue since the bug will be fixed, and the ticket is open on the product side :) |
Describe the bug
When using Meilisearch in production i want to exclude a lot of id's. But there is a limit when adding a lot of filters clauses.
Is there maybe another way of fixing this? I have a large set of invoices in one index. And i want to select only the documents thats have a relation_id from the user. But in our production website, some users already have 3000 more relations.
To Reproduce
When using a basic Laravel (PHP) envoirement i'm typing something like this. (Its a crazy example, but lets say i only want to exclude all id's except id 73)...
I get an error;
Expected behavior
I would expect that i can use a "unlimited" amount of filter clauses.
Meilisearch version: v0.25.2
The text was updated successfully, but these errors were encountered: