I was taking a look at issue 650:
https://github.com/elasticsearch/elasticsearch/issues/650 and also a
previous related one 499:
https://github.com/elasticsearch/elasticsearch/issues/499 but I think it's
not enough for a use case I am having and I would like to listen some
opinions, there is always the possibility that I am understanding it all
wrong
As the example in 650 showed, it works fine for a single facet, "tag", but
let's expand the example to two facets at the same time, for example a new
field called "date", with values {today, yesterday}, I gisted it here
Continuing with the example, I would like to search for:
message=something, tag=blue, date=yesterday
Faceting by tag and date.
I would have to use a query with term message=something, include an and
"filter" with tag=blue, and date=yesterday filters, so far so good.
The problem is that for the "tag" facet I would have to include a
"facet_filter" with a filtered query of "message=something" and
"date=yesterday", effectively all the queries plus filters except the one
used in this facet. Similar for "date" facet, I would have to include a
"facet_filter" with a filtered query of "message=something" and "tag=blue".
This gets exponential with many facets at the same time, I am even scared to
ask how is the parsing and execution done.
I don't know if it's even doable, but I was thinking in something like an
integrated faceting-filter, that joins both components. It would facet
restricted by every other query+filter (but not his own filter value), and
would add a filter to reduce the hit results.
As a concrete example to see a real use case, go to Amazon:
Yes, an ugly link, but see how the faceting is done in the left, I clicked
in "Under 1 GB" and "Line-in Recording", both facets at the same time, but
the count of "Capacity", where "Under 1 GB" belongs, are kept independently
of each other, but in relation with the other facet "Line-in Recording" and
also my text query "mp3".
Sorry for the long post, any ideas would be great,
Sebastian.