如何为具有 $oid 唯一标识符类型的嵌入文档创建 Azure 认知搜索索引?
我当前的数据结构是这样的,
"customer": {
"_id": {
"$oid": "623a4b1bdb6d0a1210fd0234"
},
"customerName": "Andrew Jr"
},
我需要为上述数据结构创建 ACS(Azure 认知搜索)。所以我使用了这样的东西:
{
"name": "customer",
"type": "Edm.ComplexType",
"fields":
[
{
"name": "customerName",
"type": "Edm.String",
"searchable": true,
"filterable": true,
"sortable": true,
"facetable": true
}
]
},
但是当我将 _id 添加为字符串数据类型时,它会向我抛出错误,例如,如下:
{
"name": "customer",
"type": "Edm.ComplexType",
"fields":
[
{
"name": "_id",
"type": "Edm.String",
"searchable": true,
"filterable": true,
"sortable": true,
"facetable": true
},
{
"name": "customerName",
"type": "Edm.String",
"searchable": true,
"filterable": true,
"sortable": true,
"facetable": true
}
]
},
有什么想法如何将以下格式添加到搜索中吗?
"_id": {
"$oid": "623a4b1bdb6d0a1210fd0234"
},
谢谢,
My current data structure is something like this,
"customer": {
"_id": {
"$oid": "623a4b1bdb6d0a1210fd0234"
},
"customerName": "Andrew Jr"
},
I will need to create ACS (Azure Cognitive Search for the above data structure. So I was using something like this:
{
"name": "customer",
"type": "Edm.ComplexType",
"fields":
[
{
"name": "customerName",
"type": "Edm.String",
"searchable": true,
"filterable": true,
"sortable": true,
"facetable": true
}
]
},
But it will throw errors to me when I add the _id as a string data type, for example, below:
{
"name": "customer",
"type": "Edm.ComplexType",
"fields":
[
{
"name": "_id",
"type": "Edm.String",
"searchable": true,
"filterable": true,
"sortable": true,
"facetable": true
},
{
"name": "customerName",
"type": "Edm.String",
"searchable": true,
"filterable": true,
"sortable": true,
"facetable": true
}
]
},
Any ideas how to add the following format to the search?
"_id": {
"$oid": "623a4b1bdb6d0a1210fd0234"
},
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您收到错误的原因很可能是字段名称无效 (
_id
)。基于定义的命名规则
此处
,字段名称只能包含字母、数字、下划线(“_”),但字段名称的第一个字符必须是字母。由于您将字段命名为
_id
,因此您将收到错误。Most likely you are getting the error is because of invalid name for the field (
_id
).Based on the naming rules defined
here
, a field name can only contain letters, numbers, underscores ("_") however the first character of the field name must be a letter.Since you are naming your field as
_id
, you will get an error.