Is it possible to filter facets via a "terms lookup"?

For example, let's say I follow the tweet's example in the facets
documentation:

curl -X DELETE "http://localhost:9200/articles"
curl -X POST "http://localhost:9200/articles/article" -d '{"title" :
"One", "tags" : ["foo"]}'
curl -X POST "http://localhost:9200/articles/article" -d '{"title" :
"Two", "tags" : ["foo", "bar"]}'
curl -X POST "http://localhost:9200/articles/article" -d '{"title" :
"Three", "tags" : ["foo", "bar", "baz"]}'

curl -X POST "http://localhost:9200/articles/_search?pretty=true" -d '
{
"size": 0,
"facets" : {
"tags" : { "terms" : {"field" : "tags"} }
}
}
'

The documentation suggests I can use a regexp, or a script, or an
explicit "exclude" clause to control which facets get returned.

However, what I want is to have an explicit list, per user, of valid
tags, and filter down the facets to just that list. Similarly to how
the "terms" filter supports a lookup in another index/document.

We currently do this via 2 roundtrips, first fetching the allowed
tags, then fetching the facets, and then intersecting the two. But it
would be great if there was a way to do this from within ES.

Thanks for your help!

--
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.
For more options, visit https://groups.google.com/groups/opt_out.