将新文档添加到 Azure 搜索索引时出错

hal*_*lei 4 json azure azure-cognitive-search

我有一个索引,其中包含几个类型为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"
    }
}
Run Code Online (Sandbox Code Playgroud)

有谁知道这个错误是什么意思?我尝试在互联网上查找,但找不到与我的情况相关的任何内容。我发送到新索引的示例请求如下所示:

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"
    }]
}
Run Code Online (Sandbox Code Playgroud)

旧索引是相同的,但它没有“权重”参数。

编辑:我使用门户创建了索引,因此我没有创建索引的确切 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
Run Code Online (Sandbox Code Playgroud)

hal*_*lei 5

Collection(Edm.String)我收到错误的原因是因为我犯了一个错误,并且在索引上的实际类型为 时尝试发送 a Edm.String