Elasticsearch provides us with powerful machine learning based tool for product recommendation for e-commerce.
What do we know about our customers?
It is relatively easy to know which products our customers have either bought, or clicked upon in the past. Using elastic search we are able to leverage this data to recommend to these users other products which have been of interest to different users who have showed an interest in the same products.
For example if our user has clicked upon a book about medieval French history, then it would seem obvious that we can show the user the most popular books in the category of medieval French history. However this approach of simply repeating products in the same category may become tedious, and we may miss many interesting possibilities to offer users products across categories. For example if the user buys a camera we would possibly want to offer the user a book on photography.
Machine Learning Product Recommendation
Elasticsearch provides us the possibility to recommend products to users based on what other users who bought the same products as them have purchased.
For example we have an index which contains all of our users, with all of the products they have purchased as shown in the mapping below.
If a user has bought a polaroid camera, then we can look up the most popular products purchased by other users who brought the same polaroid camera. This list is likely to include products which are directly related to a polaroid camera (such as polaroid film), and indirectly related (books on photography).
Significant Term Aggregation
A term aggregation may indicate products which are popular with polaroid users, but some of these may be completely unrelated to polaroid cameras, (eg. Mobile telephones) simply because they are popular with everyone (including people who buy polaroid cameras). If we want to avoid this, then we can use the significant terms aggregation, which will return products which are significantly more popular with polaroid camara buyers compared with our customer set as a whole.
The example below shows a significant term aggregation
This approach is interesting because as our volume of data increases, the quality of our recommendations improves: as time goes by, we will learn more about our specific users and at the same time grow our database of user preferences.