This content is archived. See latest version here

Last updated: Sep 26 2013


A filter facet returns the count for all documents in the search result that match a filter. The filter can be an expression just like when using the Filter method. That means it can be anything ranging from a single criterion to a very complex criterion made up of multiple sub criteria.


To request a filter facet we can use the FilterFacet method which has two parameters, a name and a filter or filter expression. The resulting facet can be retrieved from the search results object using a method with the same name but with only a name parameter. The returned object has a single property Count, which is the number of documents that match both the rest of the search query (if any) and the filter.

Below is a simple example illustration a search for all products where we request, and retrieve the value from, two filter facets.

var result = client.Search<Product>()
  .FilterFacet("In stock", x => x.InStock.Match(true))
  .FilterFacet("In stock on sale", 
    x => x.InStock.Match(true) & x.OnSale.Match(true))

int inStock = result.FilterFacet("In stock").Count;

int inStockAndOnSale = result
  .FilterFacet("In stock on sale").Count;

Do you have feedback on this documentation? Send an email to For development-related questions and discussions, refer to our Forums on