小编Ben*_*erg的帖子

如何在 Azure 搜索中使用复杂的 targetField 创建字段映射

我使用 Azure 搜索索引器对 MongoDB CosmosDB 中的文档进行索引,该数据库包含带有名为 的字段的对象_id。由于 Azure 搜索不允许在索引中的字段名称开头使用下划线,因此我想创建字段映射。

Cosmos 中的 JSON 结构 --> 索引中的结构

{
  "id": "test"
  "name": "test",
  "productLine": {
     "_id": "123",       --> "id": "123"
     "name": "test"
  }
}
Run Code Online (Sandbox Code Playgroud)

文档正是以这种情况作为示例,但仅适用于顶级字段。

"fieldMappings" : [ { "sourceFieldName" : "_id", "targetFieldName" : "id" } ]}

我尝试了以下方法:

"fieldMappings" : [ { "sourceFieldName" : "productLine/_id", "targetFieldName" : "productLine/id" } ] }

这会导致错误:

Value is not accepted. Valid values: "doc_id", "name", "productName".

为作为子字段的目标字段创建映射的正确方法是什么?

azure azure-cognitive-search

6
推荐指数
1
解决办法
2010
查看次数

标签 统计

azure ×1

azure-cognitive-search ×1