【发布时间】:2017-05-12 01:58:29
【问题描述】:
我有一个包含Edm.String 和Collection(Edm.String) 类型字段的索引。我想有另一个索引具有相同的字段加上另一个类型为Edm.Double 的字段。当我创建这样一个索引并尝试向第一个索引添加相同的值(加上新添加的 Edm.Double 值)时,我收到以下错误:
{
"error": {
"code": "",
"message": "The request is invalid. Details: parameters : An unexpected 'StartArray' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected.\r\n"
}
}
有谁知道这个错误是什么意思?我试图在互联网上寻找它,但我找不到任何与我的情况有关的东西。我发送到新索引的示例请求如下所示:
POST https://myservicename.search.windows.net/indexes/newindexname/docs/index?api-version=2016-09-01
{
"value": [{
"@search.action": "upload",
"keywords": ["red", "lovely", "glowing", "cute"],
"name": "sample document",
"weight": 0.5,
"id": "67"
}]
}
旧索引相同,但没有“权重”参数。
编辑:我使用门户创建了索引,所以我没有确切的 JSON 来创建索引,但字段大致是这样的:
Field Type Attributes Analyzer
---------------------------------------------------------------------------------------
id Edm.String Key, Retrievable
name Edm.String Searchable, Filterable, Retrievable Eng-Microsoft
keywords Collection(Edm.String) Searchable, Filterable, Retrievable Eng-Microsoft
weight Edm.Double Filterable, Sortable
【问题讨论】:
-
你能分享
newindexname索引的定义吗?特别是字段及其数据类型。 -
我无法重现该问题。我创建了一个相同的索引并使用 PowerShell 发送了相同的索引请求,它工作正常。您能否再次检查您在此处发布的 JSON 是否正是您在请求中发送的内容?
-
@BruceJohnston 原来我在从门户创建索引时犯了一个错误,并在我打算选择
Collection(Edm.String)的字段中选择了Edm.String。我重新创建了索引,一切看起来都很好。很抱歉因为一个小错误耽误了您的时间。
标签: json azure azure-cognitive-search