azureazure-cognitive-search

Custom analyzer for nested property on search service showing error in Azure


The search index and everything works fine. However, on the Azure Portal, the following error is displayed when we open the search index:

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

It appears the bug only appears for nested properties (i.e. when a nested property sets a custom analyzer). When directly using the name-analyzer on the first level, everything works as expected.

Goal: We would like to get rid of the error appearing on the portal.

Below is a minimal example to reproduce the issue on Azure:

{
    "@odata.context": "[omitted]",
    "@odata.etag": "[omitted]",
    "name": "index-test-fb",
    "defaultScoringProfile": null,
 "fields": [
    {
      "name": "Key",
      "type": "Edm.String",
      "searchable": false,
      "filterable": false,
      "retrievable": true,
      "stored": true,
      "sortable": true,
      "facetable": false,
      "key": true,
      "indexAnalyzer": null,
      "searchAnalyzer": null,
      "analyzer": null,
      "normalizer": null,
      "dimensions": null,
      "vectorSearchProfile": null,
      "vectorEncoding": null,
      "synonymMaps": []
    },
    {
      "name": "Customers",
      "type": "Collection(Edm.ComplexType)",
      "fields": [
        {
          "name": "FirstName",
          "type": "Edm.String",
          "searchable": true,
          "filterable": false,
          "retrievable": true,
          "stored": true,
          "sortable": false,
          "facetable": false,
          "key": false,
          "indexAnalyzer": null,
          "searchAnalyzer": null,
          "analyzer": "name-analyzer",
          "normalizer": null,
          "dimensions": null,
          "vectorSearchProfile": null,
          "vectorEncoding": null,
          "synonymMaps": []
        }
      ]
    }
  ],
    "scoringProfiles": [],
    "corsOptions": null,
    "suggesters": [],
    "analyzers": [{
            "@odata.type": "#Microsoft.Azure.Search.CustomAnalyzer",
            "name": "name-analyzer",
            "tokenizer": "keyword_v2",
            "tokenFilters": [
                "lowercase",
                "german_normalization",
                "asciifolding"
            ],
            "charFilters": []
        }
    ],
    "normalizers": [],
    "tokenizers": [],
    "tokenFilters": [],
    "charFilters": [],
    "encryptionKey": null,
    "similarity": {
        "@odata.type": "#Microsoft.Azure.Search.BM25Similarity",
        "k1": null,
        "b": null
    },
    "semantic": null,
    "vectorSearch": null
}

Solution

  • Apparently this is currently a bug in the Azure Search explorer (see also https://learn.microsoft.com/en-us/answers/questions/1691825/invalid-index-schema-for-customanalyzer-e-g-from-l), so at the moment we have no option but to ignore the error.

    Update 12.06.2024: Warning no longer appears on the Azure Portal.