Have you tried creating a NestedFilter?
I haven't tried it, but perhaps
.Filter(x => x.Prices(), p => p.Amount > 0 ))
The code I wrote is following the path Quan Mai suggest:
.Filter(x => !x.Prices().MatchItem(p => p.MatchTypeHierarchy(typeof(Price))))
The thing is, that is "pure" Elasticsearch query, it is possible to test the "array" and not by querying a sub-item.
I would like to use Episerver Search & Navigation -- Find -- to search for all variants that does have any prices. I am not sure how to build the correct filter to do this.
Code so far:
var itemsWithNoPrices = _client.Search<VariationContent>()
.Filter(x => x.Prices() ????? ) // <-- how to construct?
.Select(x => x.Code)
"Prices" are added by default via "nested conventions", and are of type IEnumerable<Price>. When a price exists I can see that the json in Find contains:
"$type": "Mediachase.Commerce.Pricing.CustomerPricing, Mediachase.Commerce"
"$type": "Mediachase.Commerce.Money, Mediachase.Commerce"
And when no prices exists it looks like this:
How should my filter be constructed? Or phrased differently: how do I build a filter for nested queries as "Prices$$nested"?
The reason I want to use Find and not using traversing is, that the catalog contains more than 200.000 variants and Elastic search is quite fast for this.