We're using ElasticSearch to (approximately) search a product database of approximately 500k products which come from a wide variety of categories and have a highly varied set of properties. To support our use cases, we'd like to allow users to search against (and apply as filters) the attributes of the products. For example, a user might type in 'band' and we'd propose the filters "Category: Band Saws" and "Brand: Band-Aids". http://www.homedepot.com/ provides an example of what we're looking to do.
We have things working with the approach described below, but we're running into performance and memory issues and I was hoping someone might have an alternate approach (either with 0.20 or an upcoming release) that would simplify things enough to get significantly better performance from the system.
Currently we use a structure where products have nested attributes, and each nested attribute contains a name and value property, each of which has an id (to map back to the database), a name (for searching against), and a facetValue we use for faceting across all attributes and attribute values. This allows us to do a few things:
- Faceting across all attributes in the system while maintaining enough information to apply any selections as a filter
- Typeahead search (using match_phrase_prefix) of attribute names and values in the user's current context (e.g. don't show "Material: Stainless Steel" for a 'stai' search if a user has already filtered by "Category: Televisions")
Here's a gist of a simplified version of our mapping in case it helps make things clearer: https://gist.github.com/jredburn/7ac1064703f22306bf49
If anyone has any ideas about alternate approaches that would align better with traditional usages of ElasticSearch while still delivering the experience, would very much appreciate. And if anyone is struggling with the same thing, also happy to explain the current approach in more detail. Let me know!