且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用"id"删除特定文档?在Azure搜索REST API上?

更新时间:2023-02-14 09:07:18

有关如何在Azure搜索中删除文档"的文档可以为

The documentation for how to delete "documents" in Azure Search can be found here. Since you want to delete all of the fields associated with id == 16, this should be what you are looking for.

要针对您的具体情况更具体,您将需要对以下URI发出POST请求,并在其中填写适当的服务名称,索引名称和api管理密钥(作为标头):

To be more specific for your exact situation, you will want to issue a POST request to the following URI with the appropriate service name, index name and api admin key (as a header) filled in:

POST https://[service name].search.windows.net/indexes/[index name]/docs/index?api-version=2017-11-11  
Content-Type: application/json   
api-key: [admin key]  

并带有以下请求正文:

{  
  "value": [  
    {  
      "@search.action": "delete",  
      "id": "16"  
    }  
  ]  
}

如果请求返回200,则该文档将成功从索引中删除.

If the request returns 200, then the document will have successfully been deleted from the index.

请注意,您可以通过在JSON数组中包含更多对象(每个对象具有不同的"id")来删除同一请求中的多个文档.这比一次将它们一次删除更为有效.

Note that you can delete more than one document in the same request by including more objects in the JSON array, each with a different "id". This is more efficient than deleting them one at a time.