Invalid index schema for CustomAnalyzer e.g. from learn.microsoft.com

Jocke Ek 0 Reputation points
2024-06-05T11:24:42.5166667+00:00

I want to use a CustomAnalyzer and after successfully creating my index I get a index schemal validation error (or warning) like:

Invalid index schema: fields[11].fields[7].analyzer - Analyzer should be a valid lexical analyzer name or an analyzer defined in the index definition.

I get the same error when using the public example here.
https://learn.microsoft.com/en-us/rest/api/searchservice/create-index#examples

The index get created and seams to work, the error message is not presented when creating the index it is displayed in the Search explorer.

Is this a validation bug in the Search explorer? If I replace tagsAnalyzer with a standard analyzer I don't get the error message.

Cheers
--Jocke

invalid-index-schema.png

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
801 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 17,136 Reputation points
    2024-06-07T04:36:18.8466667+00:00

    @Jocke Ek The error you're encountering when creating an index with a custom analyzer is likely due to a validation issue in the Search Explorer tool. The Search Explorer is a client-side tool that performs validation checks on the index schema, and it may not correctly recognize custom analyzers defined within the index schema.

    However, this issue does not necessarily prevent the index from being created successfully. As long as the Azure Cognitive Search service can parse and understand the custom analyzer definition, it should create the index without any issues. The example you provided from Microsoft's documentation is valid, and if you can create the index successfully using that schema, then the warning or error message you're seeing in the Search Explorer can be considered a false positive or a limitation of the Search Explorer tool.

    Here are a few points to consider:

    1. The Azure Cognitive Search service itself has a more robust validation mechanism than the Search Explorer tool. It's possible for the service to accept a schema that the Search Explorer tool considers invalid.
    2. The custom analyzer definition in the example you provided (tagsAnalyzer) is valid according to the Azure Cognitive Search service. If the index creation succeeds without any errors from the service, the index and the custom analyzer should be working as intended.
    3. The Search Explorer tool is primarily designed for exploring and testing Azure Cognitive Search indices and may have limitations when it comes to validating complex schemas or custom configurations like custom analyzers.

    If you're not encountering any functional issues with the index or the custom analyzer, you can safely ignore the warning or error message displayed in the Search Explorer. However, if you experience problems with the index or the custom analyzer's behavior, you should investigate further and ensure that the custom analyzer definition is correct.

    In summary, the error or warning you're seeing is likely a false positive or a limitation of the Search Explorer tool and should not prevent you from using the custom analyzer if the index creation succeeds without any errors from the Azure Cognitive Search service.​​​​​​​​​​​​​​​​

    Hope that helps.

    -Grace

    1 person found this answer helpful.
    0 comments No comments