我有一个索引,其中有几个类型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.rn"
}
}
有人知道这个错误意味着什么吗?我尝试在互联网上寻找它,但找不到与我的情况有关的任何内容。我要发送到新索引的示例请求如下:
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
我遇到错误的原因是因为我犯了一个错误,并且在索引上的实际类型为 Edm.String
时试图发送Collection(Edm.String)
。