On Elastic, the accelerator brand list page (that shows all brands with their number of products) has started showing 0 as product count for most brands. We haven’t found any reason why certain brands would work and some not.
The actual brand pages work fine.
Filter facets and other places on the accelerator site are showing correct numbers consistently.
So it seems only the brand list page is affected.
We are using the out-of-the-box accelerator Brand field.
It doesn’t look like it’s due to a mismatch between the Brand TextOption and PIM since the problem affects brands that have exactly the same name everywhere (Brand TextOption ID, Brand TextOption Value, Brand page name etc).
We’ve started looking at the code that computes the brand page titles (with the product count in it) but there’s no apparent place where it would fail.
Also, why would this work on Lucene and not Elastic?
I can see that the filter aggregator is setting a size of 100 of items that should be included for each tag, when fetching the tags for the brand page the size is not set and then it’s using the default value that is 10, if I remember correct. If you try to set the size parameter also for the aggregations in ProductSearchServiceDecorator.GetTagTermsAsync I think you should be able to get it to work.
Replacing .Size(0) with .Size(100) or .Size(1000) in GetTagTerms made no difference, neither before nor after an Elastic-rebuild.
During the Elastic-rebuild the numbers on the brand list page go up as well as down. After a few hundred documents, it will say e.g. Acme1 (77) Acme2 (136), and after another few hundred documents it will say e.g. Acme1 (0) Acme2 (234).
Is there any way to verify that the source data is actually correct? E.g. doing a “manual” count-per-brand in Elastic, perhaps with a well-aimed Kibana query?
Line number can differ to what you have in your solution and the changed code is in the BuildFilterAggregation and BuildTagAggregation methods, not the size of the query itself.