Exceptions when indexing Commerce items with Azure Search


Description

When using Azure Search and rebuilding indexes in Sitecore Experience Commerce solutions, the following error appears in logs:

FATAL Could not add field {EA45EDF7-CD8B-433F-99A6-EBFE3C7CE3A5} : manufacturer for indexable sitecore://web/{408C6D12-16FA-4146-B0DC-65D5B06F988A}?lang=en&ver=1
Exception: System.NotSupportedException
Message: Field 'manufacturer' with value 'System.Collections.Generic.List`1[System.String]' of type 'System.Collections.Generic.List`1[System.String]' cannot be converted to type 'System.String' declared for the field in the schema.

Solution

To resolve the issue, consider the following option:

  1. Open the Sitecore.Commerce.Engine.Connectors.Index.Azure.config file and modify the "manufacturer" field configuration in the following way:
    <field fieldName="manufacturer" boost="1f" type="System.String[]" settingType="Sitecore.ContentSearch.Azure.CloudSearchFieldConfiguration, Sitecore.ContentSearch.Azure"/>
  2. Rebuild the index.