0

I am trying to switch from Solr to Azure Cognitive Search in Sitecore 9.1, but for some reason my fields are not shown in custom index after migration.

Solr custom index configuration:

<customIndexConfiguration ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration">
    <initializeOnAdd>false</initializeOnAdd>

    <fieldMap ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/fieldMap" >
        <typeMatches hint="raw:AddTypeMatch">
            <typeMatch typeName="guidCollection" type="System.Collections.Generic.List`1[System.Guid]" fieldNameFormat="{0}_sm" multiValued="true" settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
        </typeMatches>

        <fieldNames hint="raw:AddFieldByFieldName">
            <field fieldName="category" returnType="guidCollection" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String"/>
            <field fieldName="entry_date" returnType="text" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="2f" type="System.String"/>
        </fieldNames>
    </fieldMap>
    <fieldReaders ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/fieldReaders"/>

    <documentOptions ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/documentOptions" >
        <include hint="list:AddIncludedField">
            <Custom_Item>{FD160A2F-CB96-4751-A777-0E289035D61B}</Custom_Item>
        </include>
        <exclude hint="list:AddExcludedTemplate">
            <patch:delete />
        </exclude>
    </documentOptions>

</customIndexConfiguration>

Category is Multilist field of Custom_Item in sitecore, Entry Date is Datetime field of Custom_Item.

Updated Azure Custom Index config:

<customIndexConfiguration ref="contentSearch/indexConfigurations/defaultCloudIndexConfiguration">
    <initializeOnAdd>true</initializeOnAdd>

    <fieldMap ref="contentSearch/indexConfigurations/defaultCloudIndexConfiguration/fieldMap" >
        <fieldNames hint="raw:AddFieldByFieldName">
            <field fieldName="category" boost="1f" type="System.Guid[]" settingType="Sitecore.ContentSearch.Azure.CloudSearchFieldConfiguration, Sitecore.ContentSearch.Azure"/>
            <field fieldName="entry_date" boost="2f" type="System.String" settingType="Sitecore.ContentSearch.Azure.CloudSearchFieldConfiguration, Sitecore.ContentSearch.Azure"/>
        </fieldNames>
    </fieldMap>
                    
    <documentOptions type="Sitecore.ContentSearch.DocumentBuilderOptions, Sitecore.ContentSearch" >
        <include hint="list:AddIncludedField">
            <Custom_Item>{FD160A2F-CB96-4751-A777-0E289035D61B}</Custom_Item>
        </include>
        <exclude hint="list:AddExcludedTemplate">
            <patch:delete />
        </exclude>
    </documentOptions>
                    
</customIndexConfiguration>

1 Answer 1

0

Finally I was able to resolve this issue. All changes are marked with comment sections. Correct index configuration is:

<customIndexConfiguration ref="contentSearch/indexConfigurations/defaultCloudIndexConfiguration">
    <initializeOnAdd>true</initializeOnAdd>

    <fieldMap ref="contentSearch/indexConfigurations/defaultCloudIndexConfiguration/fieldMap" >
        <fieldNames hint="raw:AddFieldByFieldName">
            <!-- Configuration of fields was updated -->
            <field fieldName="category" cloudFieldName="category_sm" searchable="YES"  retrievable="YES"  facetable="YES"  filterable="YES"  sortable="NO" boost="1f" type="System.GUID[]" settingType="Sitecore.ContentSearch.Azure.CloudSearchFieldConfiguration, Sitecore.ContentSearch.Azure"/>
            <field fieldName="entry_date" cloudFieldName="entry_date_dt" boost="2f" type="System.DateTime" format="yyyy-MM-ddTHH:mm:ss.fffZ" searchable="YES"  retrievable="YES"  facetable="YES"  filterable="YES"  sortable="YES" settingType="Sitecore.ContentSearch.Azure.CloudSearchFieldConfiguration, Sitecore.ContentSearch.Azure"/>
        </fieldNames>
    </fieldMap>
                    
    <documentOptions type="Sitecore.ContentSearch.DocumentBuilderOptions, Sitecore.ContentSearch" >
        <!-- Indexing of all fields was disabled -->
        <indexAllFields>false</indexAllFields>
        <include hint="list:AddIncludedField">
            <Custom_Item>{FD160A2F-CB96-4751-A777-0E289035D61B}</Custom_Item>
            <!-- Fields were added here -->
            <Category>{5B96A84A-98BE-4E24-A2B0-0754500D027C}</Category>
            <Entry_Date>{430D661D-01E4-4D6D-A2E0-7EA0B2653A9D}</Entry_Date>
        </include>
        <exclude hint="list:AddExcludedTemplate">
            <patch:delete />
        </exclude>
    </documentOptions>
                    
</customIndexConfiguration>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.