Hi,
I’m having difficulties getting a nested value into my Find index.
I have a Commerce Variant with a property that exposes an IEnumerable<Price>:
public IEnumerable<Price> AvailablePrices => this.Prices();
where this.Prices() is the default IPricingExtensions method. (I’ve also tried using Prices() directly but getting the same error)
In the conventions I have:
SearchClient.Instance.Conventions.NestedConventions.ForInstancesOf<DefaultVariation>().Add(x => x.AvailablePrices);
This gets indexed fine:
"AvailablePrices": [
{
"CustomerPricing": {
"$type": "Mediachase.Commerce.Pricing.CustomerPricing, Mediachase.Commerce",
"___types": [
"Mediachase.Commerce.Pricing.CustomerPricing",
"System.Object",
"System.IEquatable`1[[Mediachase.Commerce.Pricing.CustomerPricing, Mediachase.Commerce, Version=10.8.0.0, Culture=neutral, PublicKeyToken=6e58b501b34abce3]]"
]
},
"___types": [
"EPiServer.Commerce.SpecializedProperties.Price",
"System.Object",
"System.ICloneable"
],
"ValidFrom$$date": "2013-12-05T23:00:00Z",
"$type": "EPiServer.Commerce.SpecializedProperties.Price, EPiServer.Business.Commerce",
"UnitPrice": {
"Amount$$number": 210,
Still, when querying I get:
nested: ElasticSearchIllegalArgumentException[mapping for explicit nested path is not mapped as nested: [AvailablePrices]];
this is called in:
query = query.OrderBy(v => v.AvailablePrices, p => p.UnitPrice.Amount, price =>
price.ValidFrom.LessThan(DateTime.Now)
& (price.ValidUntil.Exists() | price.ValidUntil.GreaterThan(DateTime.Now))
& (price.MarketId.Value.Match("BBNL")));
Episerver Find version: 12.5
Hope anyone can help!
/Mark