Facets with 0 Count

Vote:
 

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 

#193187
May 24, 2018 18:05
Vote:
 

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?

#193204
May 25, 2018 8:16
Vote:
 

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

#193218
May 25, 2018 11:07
Vote:
 

Good luck

#193231
May 25, 2018 13:05
Vote:
 

This should do the trick:

   .TermsFacetFor(x => x.MyProperty, facet =>
                {
                    facet.Size = 100;
                    facet.AllTerms = true;
                })
#193254
May 27, 2018 23:39
Vote:
 

Per Magne, so AllTerms is the same as minimun_document_count = 0 in elastic?

#193272
May 28, 2018 10:50
Vote:
 

Basically. "all_terms" is used by facets in elasticsearch, which has been replaced by aggregation in newer versions of elasticsearch.

#193278
May 28, 2018 11:27
Vote:
 

Thank you Per Magne, will try your solution shortly, will let you know how I get on. 

#193279
May 28, 2018 11:36
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.