# Facet search / autocomplete

**URL:** https://discuss.elastic.co/t/facet-search-autocomplete/10911
**Category:** Elasticsearch
**Created:** [February 26, 2013, 8:15pm UTC](https://discuss.elastic.co/t/facet-search-autocomplete/10911 "2013-02-26T20:15:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Jeremy\_Redburn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeremy_redburn/32/2633_2.png) [@Jeremy\_Redburn](https://discuss.elastic.co/u/Jeremy_Redburn)
#### Post date: [February 26, 2013, 8:15pm UTC](https://discuss.elastic.co/t/facet-search-autocomplete/10911/1 "2013-02-26T20:15:16Z")

</div>

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/](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](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!

- Jeremy

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Felix](https://avatars.discourse-cdn.com/v4/letter/f/aeb1de/32.png) [@Felix](https://discuss.elastic.co/u/Felix)
#### Post date: [May 6, 2013, 6:50am UTC](https://discuss.elastic.co/t/facet-search-autocomplete/10911/2 "2013-05-06T06:50:13Z")

</div>

Hi Jeremy,

how do you do the automatic facetting of the dynamic set of attributes?  
Maybe you could help me with my issue? I've also posted it on Stackoverflow:

> <https://stackoverflow.com/questions/16341134/creating-dynamic-facets-in-elasticsearch>

Thx

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 2:38am UTC](https://discuss.elastic.co/t/facet-search-autocomplete/10911/3 "2017-07-06T02:38:11Z")

</div>


