Filter facet values on another field

Hi,

We store in arrays values with related flags. The following example stores
if a book is available in a specific format (we need this format for the
none ElasticSearch-part of our application):

{
"formats" : [
{ "name" : "paperback" , "available" : true },
{ "name" : "hardcover" , "available" : false }
]
}

We want to create facets for "available formats" (would contain
"paperback") and "unavailable formats" (would contain "hardcover"), i.e. if
a "name" is included as a facet value depends on the field "available".

What's the best way to achieve this with ElasticSearch? Can we create a
mapping which tells the indexer to add only "name" values into a field
"available_formats" if the related "available" value is true? Or would we
have to do this separation already before the data is send to ElasticSearch?

Many thanks!

Ron

--
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.