In Elastic search there is a setting called minimun_document_count for aggregations (that means facets) (https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#_minimum_document_count)
I do not know if there is any possibility to set that property in Episerver Find and if there were, Elastic warns about setting it to zero
"Setting min_doc_count
=0
will also return buckets for terms that didn’t match any hit. However, some of the returned terms which have a document count of zero might only belong to deleted documents or documents from other types, so there is no warranty that a match_all
query would find a positive document count for those terms."
Why do you want to show facets with 0 count?
This is due to the design we want to show Facet [0]. I have a complete list of terms from another method and will rebuild my list on this now as it seems the only real way. Rather than using AllTerms=true I will need to use Size = 100
Thanks Anyway
Minesh
This should do the trick:
.TermsFacetFor(x => x.MyProperty, facet => { facet.Size = 100; facet.AllTerms = true; })
Per Magne, so AllTerms is the same as minimun_document_count = 0 in elastic?
Basically. "all_terms" is used by facets in elasticsearch, which has been replaced by aggregation in newer versions of elasticsearch.
Thank you Per Magne, will try your solution shortly, will let you know how I get on.
Hi All,
I am using Episerver Find and want to show all Facets, including those with a 0 count.
I have tried using the AllTerms = true although this seems to limit the number of Facets Items to 10. When using Size = x option when filtering the Facets seems to get filtered out. I cant use AllTerms and Size togeather.
FilterHits has no effect on the Facets.
What I am ideally looking for is a way to use AllTerms and Size togeather
Thanks
Minesh