{"record":{"id":"1256d975388ef10a","repo":"microsoft/semantic-kernel","slug":"field-index-kind-not-supported-in-azure-ai-searc","errorCode":null,"errorMessage":"{field.index_kind} not supported in Azure AI Search.","messagePattern":"(.+?) not supported in Azure AI Search\\.","errorType":"exception","errorClass":"VectorStoreOperationException","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/azure_ai_search.py","lineNumber":261,"sourceCode":"                    sortable=not type_.startswith(\"Collection\") or type_ == \"Edm.ComplexType\",\n                    hidden=False,\n                )\n            )\n        elif field.field_type == FieldTypes.KEY:\n            fields.append(\n                SimpleField(\n                    name=field.storage_name or field.name,\n                    type=\"Edm.String\",  # hardcoded, only allowed type for key\n                    key=True,\n                    filterable=True,\n                    searchable=True,\n                )\n            )\n        elif field.field_type == FieldTypes.VECTOR:\n            if not field.type_:\n                logger.debug(f\"Field {field.name} has not specified type, defaulting to Collection(Edm.Single).\")\n            if field.index_kind not in INDEX_ALGORITHM_MAP:\n                raise VectorStoreOperationException(f\"{field.index_kind} not supported in Azure AI Search.\")\n            if field.distance_function not in DISTANCE_FUNCTION_MAP:\n                raise VectorStoreOperationException(f\"{field.distance_function} not supported in Azure AI Search.\")\n\n            profile_name = f\"{field.storage_name or field.name}_profile\"\n            algo_name = f\"{field.storage_name or field.name}_algorithm\"\n            fields.append(\n                SearchField(\n                    name=field.storage_name or field.name,\n                    type=TYPE_MAP_VECTOR[field.type_ or \"default\"],\n                    searchable=True,\n                    vector_search_dimensions=field.dimensions,\n                    vector_search_profile_name=profile_name,\n                    hidden=False,\n                )\n            )\n            search_profiles.append(\n                VectorSearchProfile(\n                    name=profile_name,","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/azure_ai_search.py#L243-L279","documentation":"Raised in _definition_to_azure_ai_search_index when a VECTOR field's index_kind is not a key in INDEX_ALGORITHM_MAP. Azure AI Search only supports HNSW, FLAT (exhaustive KNN), and DEFAULT (alias for HNSW). Other index kinds defined by the IndexKind enum (IVF_FLAT, DISK_ANN, QUANTIZED_FLAT, DYNAMIC) are valid for other stores but not for Azure AI Search, so index creation fails with a VectorStoreOperationException.","triggerScenarios":"Calling ensure_collection_exists() on a collection whose definition sets a vector field's index_kind to IndexKind.IVF_FLAT, IndexKind.DISK_ANN, IndexKind.QUANTIZED_FLAT, or IndexKind.DYNAMIC. Occurs at index-build time during collection creation.","commonSituations":"Porting a model definition from Azure Cosmos DB NoSQL or MongoDB Atlas (which accept disk_ann / quantized_flat / ivf_flat) to Azure AI Search without changing index_kind; copy-pasting a definition from a cross-store tutorial.","solutions":["Set the vector field's index_kind to IndexKind.HNSW (recommended for most workloads), IndexKind.FLAT, or IndexKind.DEFAULT.","If you need disk-based or quantized indexes, use Azure Cosmos DB NoSQL or MongoDB Atlas instead of Azure AI Search.","Validate all vector fields in the definition against INDEX_ALGORITHM_MAP before calling ensure_collection_exists()."],"exampleFix":"// before\nfield(type_='float', name='embedding', index_kind=IndexKind.DISK_ANN)\n\n// after\nfield(type_='float', name='embedding', index_kind=IndexKind.HNSW)","handlingStrategy":"validation","validationCode":"from semantic_kernel.connectors.azure_ai_search import INDEX_ALGORITHM_MAP\n\ndef validate_vector_index_kinds(definition) -> list[str]:\n    bad = []\n    for f in definition.fields:\n        if f.field_type.value == \"vector\" and f.index_kind not in INDEX_ALGORITHM_MAP:\n            bad.append(f\"{f.name}: {f.index_kind}\")\n    return bad\n\nassert not validate_vector_index_kinds(definition)","typeGuard":null,"tryCatchPattern":"from semantic_kernel.exceptions import VectorStoreOperationException\ntry:\n    await collection.ensure_collection_exists()\nexcept VectorStoreOperationException as e:\n    if \"not supported in Azure AI Search\" in str(e) and \"index\" in str(e).lower():\n        # change index_kind to HNSW/FLAT/DEFAULT\n        ...\n    raise","preventionTips":["Default vector fields to IndexKind.HNSW unless you need exact (FLAT) search.","When porting a definition between stores, re-map index_kind per store — each has its own MAP.","Validate the definition against INDEX_ALGORITHM_MAP in a test."],"tags":["schema","vector-index","azure-ai-search","data-model"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}