{"record":{"id":"64344adfb040ec1b","repo":"microsoft/semantic-kernel","slug":"field-type-not-supported-in-azure-ai-search","errorCode":null,"errorMessage":"{field.type_} 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":230,"sourceCode":"    definition: VectorStoreCollectionDefinition,\n    encryption_key: SearchResourceEncryptionKey | None = None,\n) -> SearchIndex:\n    \"\"\"Convert a VectorStoreRecordDefinition to an Azure AI Search index.\"\"\"\n    fields = []\n    search_profiles = []\n    search_algos = []\n\n    for field in definition.fields:\n        if field.field_type == FieldTypes.DATA:\n            if not field.type_:\n                logger.debug(f\"Field {field.name} has not specified type, defaulting to Edm.String.\")\n            if field.type_ and field.type_ not in TYPE_MAP_DATA:\n                if field.type_.startswith(\"dict\"):\n                    type_ = TYPE_MAP_DATA[\"dict\"]\n                elif field.type_.startswith(\"list\") and \"dict\" in field.type_:\n                    type_ = TYPE_MAP_DATA[\"list[dict]\"]\n                else:\n                    raise VectorStoreOperationException(f\"{field.type_} not supported in Azure AI Search.\")\n            else:\n                type_ = TYPE_MAP_DATA[field.type_ or \"default\"]\n            fields.append(\n                SearchField(\n                    name=field.storage_name or field.name,\n                    type=type_,\n                    filterable=field.is_indexed or field.is_full_text_indexed,\n                    # searchable is set first on the value of is_full_text_searchable,\n                    # if it is None it checks the field type, if text then it is searchable\n                    searchable=type_ in (\"Edm.String\", \"Collection(Edm.String)\")\n                    if field.is_full_text_indexed is None\n                    else field.is_full_text_indexed,\n                    sortable=not type_.startswith(\"Collection\") or type_ == \"Edm.ComplexType\",\n                    hidden=False,\n                )\n            )\n        elif field.field_type == FieldTypes.KEY:\n            fields.append(","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/azure_ai_search.py#L212-L248","documentation":"Raised in _definition_to_azure_ai_search_index when a DATA (non-key, non-vector) field has a type_ that is not a key in TYPE_MAP_DATA and does not begin with 'dict' or match 'list...dict'. Azure AI Search only maps a fixed set of Python types (str, int, float, bool, and collections thereof, plus dict/complex). Any other type string means the index schema cannot be generated, so collection creation is aborted with a VectorStoreOperationException.","triggerScenarios":"Calling ensure_collection_exists() on a collection whose record definition annotates a data field with an unmapped type such as 'datetime', 'tuple', 'set', 'bytes', a custom class name, or a generic like 'list[tuple]'. The error surfaces when the index is built from the definition, not when the collection object is constructed.","commonSituations":"Defining a VectorStoreRecordDefinition with a field typed as datetime.datetime or Decimal and expecting the connector to handle it; using type annotations the connector cannot introspect into a supported Edm type; upgrading a model that previously used 'dict' but was changed to a dataclass type name.","solutions":["Re-type the offending field to a supported primitive: 'str', 'int', 'float', 'bool', or a supported 'list[...]' / 'dict'.","For datetime/Decimal values, store them as 'str' (ISO 8601) and convert in your serialize/deserialize overrides.","For nested objects, model the field as 'dict' (maps to Edm.ComplexType) and ensure the contents are JSON-serializable.","Inspect TYPE_MAP_DATA in azure_ai_search.py to confirm the exact supported type strings before redefining the model."],"exampleFix":"// before\nfield(type_='datetime', name='created_at')\n\n// after\nfield(type_='str', name='created_at')  # store ISO-8601 string","handlingStrategy":"validation","validationCode":"from semantic_kernel.connectors.azure_ai_search import TYPE_MAP_DATA\nSUPPORTED = set(TYPE_MAP_DATA) | {\"dict\"}\n\ndef validate_data_field_types(definition) -> list[str]:\n    bad = []\n    for f in definition.fields:\n        if f.field_type.value == \"data\" and f.type_:\n            t = f.type_\n            if t not in SUPPORTED and not t.startswith(\"dict\") and not (t.startswith(\"list\") and \"dict\" in t):\n                bad.append(f\"{f.name}: {t}\")\n    return bad\n\nbad = validate_data_field_types(definition)\nassert not bad, f\"Unsupported types: {bad}\"","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):\n        # fix the offending field type in the definition\n        ...\n    raise","preventionTips":["Keep DATA field types to str/int/float/bool or list[...]/dict.","Store datetime/Decimal as ISO strings and convert in (de)serialize overrides.","Add a unit test that builds the definition and checks each field type against TYPE_MAP_DATA."],"tags":["schema","data-model","azure-ai-search","type-mapping"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}