Filter facet values on another field


We have arrays that contain a flag next to the value, e.g. to store the
availability of each book format (we need to store the raw data in this
particular format):

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

We would like to create facets "Available format" (which would contain only
"paperback") and "Unavailable format" (which would only contain

What's the best approach to create these facets in ElasticSearch? For
example: Could we define in the mapping that only format names should be
included in the index "available_formats" if the flag "available" is true
for this particular format? Or do we need to split this out already before
entering the data into ElasticSearch?

Many thanks!


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
For more options, visit