Azure认知搜索:如何映射嵌入文档列?
创建 ACS 索引时,我将 mongodb 作为后端数据源,并且 mongodb 中的一些列是 _id。根据 ACS 索引器的定义,名称不能以 _ 开头,因此我需要为 mongodb 集合列创建一些到 ACS 索引名称的映射。
mongodb 数据如下所示:
"customer": {
"_id": {
"$oid": "623a4b1bdb6d0a1210fd0234"
},
"customerName": "Andrew Jr"
}
我创建的 ACS 索引定义是:
{
"name": "customer",
"type": "Edm.ComplexType",
"fields": [
{
"name": "id",
"type": "Edm.String",
"searchable": true,
"filterable": true,
"retrievable": true,
"sortable": true,
"facetable": true,
"key": false,
"indexAnalyzer": null,
"searchAnalyzer": null,
"analyzer": null,
"normalizer": null,
"synonymMaps": []
},
{
"name": "customerName",
"type": "Edm.String",
"searchable": true,
"filterable": true,
"retrievable": true,
"sortable": true,
"facetable": true,
"key": false,
"indexAnalyzer": null,
"searchAnalyzer": null,
"analyzer": null,
"normalizer": null,
"synonymMaps": []
}
]
}
所以基本上我想将客户嵌入文档中的字段 _id 从 mongodb 数据源映射到索引列 id。
我尝试使用索引器将它们映射在一起:
"fieldMappings": [ { "sourceFieldName" : "_id", "targetFieldName" : "id" } ],
我收到错误:字段映射指定索引中不存在的目标字段“id”
如何定义 sourceFieldName 和 targertFieldName 来引用嵌入文档?
I have mongodb as the backend datasource when creating the ACS index and some columns from mongodb is _id. Per definition of the ACS indexer the name can not start with _ so I will need to create some mapping for the mongodb collection columns to the ACS index names.
The mongodb data is like below:
"customer": {
"_id": {
"$oid": "623a4b1bdb6d0a1210fd0234"
},
"customerName": "Andrew Jr"
}
The ACS index definition I created is:
{
"name": "customer",
"type": "Edm.ComplexType",
"fields": [
{
"name": "id",
"type": "Edm.String",
"searchable": true,
"filterable": true,
"retrievable": true,
"sortable": true,
"facetable": true,
"key": false,
"indexAnalyzer": null,
"searchAnalyzer": null,
"analyzer": null,
"normalizer": null,
"synonymMaps": []
},
{
"name": "customerName",
"type": "Edm.String",
"searchable": true,
"filterable": true,
"retrievable": true,
"sortable": true,
"facetable": true,
"key": false,
"indexAnalyzer": null,
"searchAnalyzer": null,
"analyzer": null,
"normalizer": null,
"synonymMaps": []
}
]
}
So basically I want to map the field _id inside customer embedded document from the mongodb data source to the index column id.
I tried to use the indexer to map them together :
"fieldMappings": [ { "sourceFieldName" : "_id", "targetFieldName" : "id" } ],
I am getting the error: Field mapping specifies target field 'id' that doesn't exist in the index
How can I define the sourceFieldName and targertFieldName to reference to embedded document ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我也一直在努力解决这个问题 - 如果你的问题与我的相同,不幸的是我认为这是不可能的。
在 Microsoft 文档此处,在页面顶部附近,它表示字段映射适用于:
I've just been struggling with this too - if your issue is the same as mine, I don't think it is possible unfortunately.
In the Microsoft documentation here, near the top of the page it says field mappings apply to:
将“targetFieldName”值更改为“name”而不是“id”并检查执行情况。
Change the "targetFieldName" value to "name" instead of "id" and check with the execution.
您可以使用更新索引器来管理现有索引器的字段映射API 请求。
一个源字段可以在多个字段映射中引用。
You can manage the field mappings of an existing indexer using the Update Indexer API request.
A source field can be referenced in multiple field mappings.