Saturday, September 8, 2018

Sitecore and Azure Search - Found 2 key fields in index

After changing an index definition I deleted my web index from Azure Search and re-created it ready to perform a full index rebuild. This led the following error:
Exception: Sitecore.ContentSearch.Azure.Http.Exceptions.AzureSearchServiceRESTCallException
Message: {"error":{"code":"","message":"The request is invalid. Details: index : Found 2 key fields in index 'sitecore-web-index-secondary'. Each index must have exactly one key field.\r\n"}}
This error occurred because when I created the index in Azure, I had left the default key field named id present.

Sitecore Azure Search - Create index
This was incorrect as Sitecore would try and add another key azureuniqueid. When creating the index, if you set that default key field to be called azureuniqueid, this error will not occur.

No comments:

Post a Comment