我正在尝试使用邮递员上传数据并收到错误:“此资源不支持请求实体的媒体类型'text / plain'。”
我正在使用邮递员:
url : https://azuresearchpocxxxx.search.windows.net/indexes/beers/docs/index?api-version=2017-11-11
request type : POST
content-type : text/plain
数据位于.md文件中:
| ID | Name | ActivelyBrewed | IBU | ABV | Flavors | LastTappedOn | BreweryId | BreweryName |
|----|---------------------------|----------------|-----|------|------------------------------|--------------|-----------|----------------------------|
| 1 | Ahool Ale | true | 33 | 5.4 | biscuity | 1/23/2016 | b3TplPdS | Northern Hemisphere Brewco |
| 2 | Agogwe Ale | true | 28 | 2.9 | wheat, floral | 5/18/2016 | Ek4mwsBoe | Southern Hemisphere Brewco |
| 3 | Aswang Ale | true | 31 | 4.2 | butter, yeast | 2/13/2016 | b3TplPdS | Northern Hemisphere Brewco |
| 4 | Buru's Barley Wine | true | 76 | 11.1 | raisin, dried fruit, bourbon | 1/1/2016 | b3TplPdS | Northern Hemisphere Brewco |
| 7 | Hyote Chocolate Stout | true | 78 | 7.4 | caramel, chocolate | 1/7/2016 | zkXBTiBol | North American Brewco |
| 8 | Igopogo Pilsner | true | 36 | 5.7 | malt, bread | 11/15/2015 | zkXBTiBol | North American Brewco |
| 9 | Jackalobe Lager | true | 29 | 3.3 | fruit, citrus | 3/15/2016 | zkXBTiBol | North American Brewco |
| 11 | Mahamba Barley Wine | true | 57 | 9.7 | malt, raisin | 4/24/2016 | Ek4mwsBoe | Southern Hemisphere Brewco |
| 12 | Megalodon Pale Ale | true | 99 | 5.7 | bread, hops, pine | 3/31/2016 | VkNvPjBse | Oceanic Brewco |
| 16 | Pope Lick Porter | true | 39 | 6.5 | smokey, chocolate, banana | 1/6/2016 | zkXBTiBol | North American Brewco |
| 17 | Chocolate Pukwudgie Stout | true | 35 | 12.2 | chocolate, coffee | 2/25/2016 | zkXBTiBol | North American Brewco |
| 18 | Sharlie Pilsner | true | 31 | 4.1 | grass | 2/18/2016 | zkXBTiBol | North American Brewco |
| 19 | Sigbin Stout | false | 65 | 8.1 | coffee, caramel | 3/18/2016 | b3TplPdS | Northern Hemisphere Brewco |
| 21 | Snallygaster Pale Ale | false | 89 | 9.7 | pine, honey | 4/29/2016 | zkXBTiBol | North American Brewco |
| 22 | Tikibalang Barley Wine | true | 45 | 9.6 | bourbon | 3/14/2016 | b3TplPdS | Northern Hemisphere Brewco |
| 26 | Pale Popobawa Ale | true | 30 | 4.4 | wheat | 5/9/2016 | Ek4mwsBoe | Southern Hemisphere Brewco |
| 27 | North Adjule Lager | true | 30 | 3.7 | citrus | 2/8/2016 | Ek4mwsBoe | Southern Hemisphere Brewco |
我已经创建了一个索引和字段来保存这种类型的数据。
我尝试使用Azure门户中的导入数据选项(它没有选择.md文件的选项)
对此有任何想法表示赞赏。
这里有2个选项:将数据导入为“分隔文本”文件或逐行上传数据。
选项1(“分隔文本”文件)
同样,您可以使用REST API(Data source,Index,Indexer)完成所有工作。索引器将尝试索引不包含任何实际数据的第二行,这可能是可接受的,具体取决于您的用例。
您可能需要在第二行设置“最大失败项目”以使其失败。
选项2(POST到索引)
将Add Document REST API用于md文件的每一行,并将@ search.action设置为“mergeOrUpload”。 content-type必须是“application / json”,你需要生成一个包含数据中所有键值对的JSON主体。
如果您的数据将被更新,那么您应该使用选项1并按计划设置索引器,以便自动获取更改。