Reputation: 9596
I have 20,000,000 line items in Elasticsearch that I am happily searching (it's working amazingly well).
There is an added dimension though that I don't know how to solve:
A user can "buy" those items (in batches of 1,000 to 100,000) and I need my search to only return the items that they have not previously "bought". I'd solve this with a LEFT JOIN in SQL.
I could add a boughtBy[] field to each item, but then I would need to update lots of documents every time a user buys. Feels kind of wrong?
Upvotes: 2
Views: 5589
Reputation: 7571
Elasticsearch uses Lucene which supports blockjoin. In Elasticsearch that is Parent-Child Relationships. It gives you a join but it also comes with limitations (it's no longer possible to arbitrarily distribute documents across nodes, memory requirements can explode in certain scenarios).
Elasticsearch documentation gives you a nice overview of the relationship modelling options.
If you need deep joins, more complex relationships, etc., you might consider looking into the SIREn plugin.
(disclaimer: I currently work for the company that develops SIREn)
Upvotes: 4