Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Azure search ARM模板中添加索引创建/配置_Azure_Azure Cognitive Search_Arm Template - Fatal编程技术网

在Azure search ARM模板中添加索引创建/配置

在Azure search ARM模板中添加索引创建/配置,azure,azure-cognitive-search,arm-template,Azure,Azure Cognitive Search,Arm Template,有几种方法可以通过ARM模板创建Azure搜索服务(示例:) 我想知道的是,有没有一种方法可以在ARM模板中定义特定的索引(字段、数据源、索引器等) 我知道您可以使用REST服务来创建和修改索引,但我不希望在创建我的资源组和Azure搜索服务后由单独的脚本/应用程序来处理该问题。否,您不能在ARM模板中创建索引。我以前读过的术语是,ARM用于管理Azure控制平面。+1唐的评论。您需要使用或创建索引。如果您碰巧使用PowerShell创建服务,您可能会发现以下代码非常有用,它使用Invoke R

有几种方法可以通过ARM模板创建Azure搜索服务(示例:)

我想知道的是,有没有一种方法可以在ARM模板中定义特定的索引(字段、数据源、索引器等)


我知道您可以使用REST服务来创建和修改索引,但我不希望在创建我的资源组和Azure搜索服务后由单独的脚本/应用程序来处理该问题。

否,您不能在ARM模板中创建索引。我以前读过的术语是,ARM用于管理Azure控制平面。

+1唐的评论。您需要使用或创建索引。如果您碰巧使用PowerShell创建服务,您可能会发现以下代码非常有用,它使用Invoke RestMethod和一组包含索引模式和一些文档的.JSON文件调用REST API

#------------------------#
# Setting up search index#
#------------------------#
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", 'application/json')
$headers.Add("api-key", $searchApiKey)

Write-Host 
Write-Host "Creating Index..."
$schemaFile = "$(Split-Path $MyInvocation.MyCommand.Path)\zipcodes.schema"
$response = Invoke-RestMethod -TimeoutSec 10000 $searchServiceUrl"/indexes/zipcodes2?api-version=2015-02-28-Preview" -Method Put -Headers $headers -Body "$(get-content $schemaFile)"
Write-Host $response

$jsonFile = "$(Split-Path $MyInvocation.MyCommand.Path)\zipcodes1.json"
Write-Host 
Write-Host "Adding Documents from $jsonFile..."
$response = Invoke-RestMethod -TimeoutSec 10000 $searchServiceUrl"/indexes/zipcodes2/docs/index?api-version=2015-02-28-Preview" -Method Post -Headers $headers -Body "$(get-content $jsonFile)"
Write-Host $response

Azure Search目前不支持通过ARM模板管理索引。如果此功能对您很重要,请在上添加一项以帮助我们确定其优先级。

感谢您的回答。现在这并不重要,因为有很多方法可以解决。谢谢你的片段,我最后做了类似的事情。它将不得不这样做,直到进一步的支持被添加!