I've been working on advanced parametric search with elasticsearch v1.1 and am having trouble getting aggregations to work in the way I'd like. I've scoured the documentation and tried a couple different approaches without luck, so I'm hoping someone on this list can help.
I have an index, "parts", and each indexed item has properties that I'd like to use for parametric search, along with some text fields that I'll allow the user to query. On the frontend, I'd like to present the user with a search query input, but also a number of parametric filtering options...here's how that looks with only category filtering applied: http://cl.ly/image/0N1K0m141w1s The challenges arise once I want to select a parametric filter, e.g.: http://cl.ly/image/1F382C050J32 Here, I've checked "0.14" under "Weights". Notice that the other options for weights have disappeared. This is of course because ES is only aggregating the weights in the result set, and the only value in the result set is "0.14". For the user, this is no good because they should be able to select other weight values. On the backend, I'm including the weight condition in my query: https://gist.github.com/cheyner/10471361#file-elastic-parts-condition-in-query So I took another approach, and put the weight condition in the filters, rather than the query, so it wouldn't affect aggregations. Here's how the backend settings look now: https://gist.github.com/cheyner/10471361#file-elastic-parts-condition-in-filters And here's the frontend result: http://cl.ly/image/2c262N0j2M0M The good news is that now I can see the sibling choices for my weight filters, along with accurate counts of how selecting a sibling option would affect the query results. The problem is that, because the weight condition is not considered in aggregations, the aggregation numbers are off for all of the non-weight parametric options. For example, the "Material" option has an aggregate count of 5 results...but selecting it would actually decrease the results to 0. Does anyone know of a good solution for this? It seems fundamental to a lot of parametric search solutions, so I'm hoping there's an answer. The only route I can see now seems really expensive and messy: for each aggregation, I need to apply all of the query conditions in the aggregation filters...for example: https://gist.github.com/cheyner/10471361#file-elastic-parts-conditions-in-aggregations -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/19d42213-000a-4033-ac71-90d25ee1bd0c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
