通过调用 REST 端点不工作将字段映射添加到 'base64Encode' 索引字段:"A resource without a type name was found"
Adding a field mapping to 'base64Encode' an index field by calling REST endpoint not working: "A resource without a type name was found"
我正在尝试通过向 https://searchservicename.search.windows.net/indexes/indexName?api-version=2017-11-11
发送 PUT 请求来更新搜索索引(使用 Update Indexer),但它不起作用。
如果我对字段列表发出完全相同的请求,该请求会按预期工作并且我会收到 200。一旦我也尝试添加 fieldMappings
,我就会收到错误消息。
我的 Json 我将添加到请求中 "application/json":
{
"name": "indexName",
"fields": [
<List of Valid Fields w/ Valid Types>
],
"fieldMappings": [
{
"sourceFieldName": "fieldName",
"targetFieldName": "fieldName",
"mappingFunction": {
"name": "base64Encode"
}
}
]
}
调用 API 时,我得到的错误是:
{Search request failed: {"error":{"code":"","message":"The request is invalid. Details: index : A resource without a type name was found, but no expected type was specified. To allow entries without type information, the expected type must also be specified when the model is specified.\r\n"}}
我希望请求 return 200 并添加字段映射。
我得到的错误似乎与字段列表有关,但如前所述,请求按预期工作,具有相同的正文减去字段映射。
如果您需要我提供任何其他信息,请告诉我 - 谢谢。
应将字段映射添加到索引器,而不是索引。根据您的请求,您正在尝试更新索引。
我正在尝试通过向 https://searchservicename.search.windows.net/indexes/indexName?api-version=2017-11-11
发送 PUT 请求来更新搜索索引(使用 Update Indexer),但它不起作用。
如果我对字段列表发出完全相同的请求,该请求会按预期工作并且我会收到 200。一旦我也尝试添加 fieldMappings
,我就会收到错误消息。
我的 Json 我将添加到请求中 "application/json":
{
"name": "indexName",
"fields": [
<List of Valid Fields w/ Valid Types>
],
"fieldMappings": [
{
"sourceFieldName": "fieldName",
"targetFieldName": "fieldName",
"mappingFunction": {
"name": "base64Encode"
}
}
]
}
调用 API 时,我得到的错误是:
{Search request failed: {"error":{"code":"","message":"The request is invalid. Details: index : A resource without a type name was found, but no expected type was specified. To allow entries without type information, the expected type must also be specified when the model is specified.\r\n"}}
我希望请求 return 200 并添加字段映射。
我得到的错误似乎与字段列表有关,但如前所述,请求按预期工作,具有相同的正文减去字段映射。
如果您需要我提供任何其他信息,请告诉我 - 谢谢。
应将字段映射添加到索引器,而不是索引。根据您的请求,您正在尝试更新索引。