azure - 使用 VScode Azure Cognitive Services 扩展一次在索引中插入多个文档。(Azure 搜索服务)
问题描述
我想一次将多个文档插入到Azure 搜索服务中的索引中。我正在使用 VScode 扩展Azure Cognitive Services插入,如他们的文档中所述。
链接到官方文档: https ://docs.microsoft.com/en-us/azure/search/search-get-started-vs-code
官方文档提到了插入单个 JSON 的方法,即Right Click Document->Create new document。
我尝试使用上述方法插入多个用逗号分隔的 JSON 文档(如下所示),我得到了预期的错误:
Unexpected token, in JSON at position 915
我尝试在一个创建新文档中插入多个文档:
{
"HotelId": "4",
"HotelName": "Sublime Cliff Hotel",
"Description": "Sublime Cliff Hotel is located in the heart of the historic center of Sublime in an extremely vibrant and lively area within short walking distance to the sites and landmarks of the city and is surrounded by the extraordinary beauty of churches, buildings, shops and monuments. Sublime Cliff is part of a lovingly restored 1800 palace.",
"Description_fr": null,
"Category": "Boutique",
"Tags": [
"concierge",
"view",
"24-hour front desk service"
],
"ParkingIncluded": true,
"LastRenovationDate": "1960-02-06T00:00:00Z",
"Rating": 4.6,
"Address": {
"StreetAddress": "7400 San Pedro Ave",
"City": "San Antonio",
"StateProvince": "TX",
"PostalCode": "78216",
"Country": "USA"
}
},
{
"HotelId": "5",
"HotelName": "Sublime Cliff Hotel",
"Description": "Sublime Cliff Hotel is located in the heart of the historic center of Sublime in an extremely vibrant and lively area within short walking distance to the sites and landmarks of the city and is surrounded by the extraordinary beauty of churches, buildings, shops and monuments. Sublime Cliff is part of a lovingly restored 1800 palace.",
"Description_fr": null,
"Category": "Boutique",
"Tags": [
"concierge",
"view",
"24-hour front desk service"
],
"ParkingIncluded": true,
"LastRenovationDate": "1960-02-06T00:00:00Z",
"Rating": 4.6,
"Address": {
"StreetAddress": "7400 San Pedro Ave",
"City": "San Antonio",
"StateProvince": "TX",
"PostalCode": "78216",
"Country": "USA"
}
}
有谁知道使用 VScode 在索引中一次插入多个文档的任何方法?
解决方案
您可以使用Postman执行相同的操作,方法是使用在正文中传递的 JSON 创建一个 POST 请求。这适用于索引中的单个和多个文档条目。
官方文档链接 - https://docs.microsoft.com/en-us/azure/search/search-get-started-rest
推荐阅读
- ubuntu - 用来自另一个文件的不同文本逐行替换部分行
- google-apps-marketplace - Google Apps Marketplace 发布被拒绝
- batch-file - | 这时候出乎意料
- java - Android/Java - IO 异常 - 似乎无法加载 HTML 资产
- python-3.x - win32gui 选择两个同名窗口
- azure - LUIS 在奥地利
- javascript - 如何在 react native 中使用 Flatlist 实现多选?
- laravel - laravel黄昏随机选择阻止第一个选项
- c++ - 从二进制文件读取时,Boost Serialization 抛出异常
- scala - 将akka流源[A,B]映射到源[A,NotUsed]