你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
为基于索引器的索引生成索引架构时,源数据中的数据类型必须映射到目标索引中字段允许的数据类型。
本文提供 SQL 数据类型、JSON 数据类型和 Azure AI 搜索之间的数据类型比较。 它包含以下部分:
SQL Server 数据类型到 Azure AI 搜索数据类型
| SQL Server 数据类型 | 允许的目标索引字段类型 | 注释 |
|---|---|---|
| 比特 | Edm.Boolean、Edm.String | |
| int、smallint、tinyint | Edm.Int32、Edm.Int64、Edm.String | |
| bigint | Edm.Int64、Edm.String | |
| real、float | Edm.Double、Edm.String | |
| 小钱, 钱 十进制 数字 |
Edm.String | Azure AI 搜索不支持将十进制类型转换为 Edm.Double,因为这样做会失去精度。 |
| char、nchar、varchar、nvarchar | Edm.String Collection(Edm.String) 的 Collection(Edm.String) 中。 有关如何将字符串列转换为 Collection(Edm.String) 的详细信息,请参阅字段映射函数 |
|
| smalldatetime、datetime、datetime2、date、datetimeoffset | Edm.DateTimeOffset、Edm.String | |
| uniqueidentifer | Edm.String | |
| rowversion | N/A | 行版本列不能存储在搜索索引中,但可用于更改跟踪。 |
| 地理 | Edm.GeographyPoint、Edm.String | 如果使用 地理数据类型,则仅支持具有 SRID 4326(默认值)的 POINT 类型的地理实例。 如果使用字符串,则仅支持 以下格式 的 GeoJSON 点: {"type": "Point", "coordinates": [long, lat]} |
| 时间、时间跨度 varbinary 图像 xml 几何 CLR 类型 |
N/A | 不支持。 |
JSON 数据类型到 Azure AI 搜索数据类型
| JSON 数据类型 | 允许的目标索引字段类型 |
|---|---|
| 布尔 | Edm.Boolean、Edm.String |
| 整数 | Edm.Int32、Edm.Int64、Edm.String |
| 浮点数 | Edm.Double、Edm.String |
| 字符串 | Edm.String |
| 原始类型的数组,例如 [ “a”, “b”, “c” ] | Collection(Edm.String) |
| 类似于日期的字符串 | Edm.DateTimeOffset、Edm.String |
| GeoJSON 点对象 | Edm.GeographyPoint GeoJSON 点是 以下格式的 JSON 对象: {"type" : "Point", "coordinates": [long, lat]} |
| JSON 对象 | Edm.Complex类型 Azure AI 搜索将 JSON 对象映射到相应的复杂类型架构 |