Search code examples
azureazure-cognitive-search

Can't add Azure Search to SQL Database


I have created Azure Search resource, and also SQL Database.

I'm trying to use "Add Azure Search" option in Azure Portal.

It splited to 2 steps.

  1. Data source creation (done)
  2. Indexer creation

When i'm trying to create indexer, it says

Import configuration failed, error creating Index

Error creating Index: "The request is invalid."

What does it mean? There is no any details.

My Table Schema looks like this:

Table schema


Solution

  • Did you change any of the types in the index from the defaults? Here is a mapping of what SQL types map to Azure Cognitive Search index field types: https://learn.microsoft.com/en-us/azure/search/search-howto-connecting-azure-sql-database-to-azure-search-using-indexers#mapping-between-sql-and-azure-cognitive-search-data-types From my link, nvarchar maps to Edm.String or Collection(Edm.String). In your screenshot above, it looks like you've changed several field types (to Edm.DateTimeOffset and Edm.Int64, for example). That may be causing the error when it tries to create the index.

    Or, it may be that you specified a ‘suggester name’ and ‘search mode’, but none of the index fields have ‘Suggester’ checked (hard to tell if the screenshot includes all fields or not). If you need a suggester, you should mark at least one field to use it. If you don’t need it, don't fill in those fields; otherwise the index creation will fail.