没有找到与请求URI匹配的HTTP资源'https://my-resource.search.windows.net/indexes('my-index')?api-version=2017-11-11

问题描述 投票:0回答:1

我需要一些关于天蓝色搜索(自定义分析仪)的帮助。我在azure搜索资源中创建了索引。我将cosmosdb中的数据导入到我的azure-search索引中。在将数据添加到cosmos db时,我没有添加分析器。现在,我尝试通过Rest API使用分析器和标记器更新索引,如下所示

 API(POST) https://my-resource.search.windows.net/indexes/my-index?api-version=2017-11-11
        {
            "name":"my-index",
            "fields":[

                { "name":"id", "type":"Edm.String", "key":true, "searchable":true,"filterable":true,"analyzer":"my_ngram" },
                { "name":"LastName","type":"Edm.String", "searchable":true,"filterable":true, "analyzer":"my_ngram" }
            ],
            "analyzers":[
                {
                "name":"my_ngram",
                "@odata.type":"#Microsoft.Azure.Search.CustomAnalyzer",
                "charFilters": ["html_strip"],
                "tokenizer":"my_tokenizer",
                "tokenFilters":[ "cjk_width","lowercase" ]
                }
            ],
            "tokenizers":[
                {
                "name":"my_tokenizer",
                "@odata.type":"#Microsoft.Azure.Search.NGramTokenizer",
                "minGram":2,
                "maxGram":5
                }
            ]
        }

但是我收到以下错误

{
    "error": {
        "code": "",
        "message": "No HTTP resource was found that matches the request URI 'https://my-resource.search.windows.net/indexes('my-index')?api-version=2017-11-11'."
    }
}

谁能告诉我如何为已经创建的天蓝色搜索索引添加自定义分析器?

c# azure-cosmosdb azure-search
1个回答
0
投票

你可以尝试对该URL的GET请求,看看你是否可以获得索引定义?此外,update operation to the index将是PUT操作而不是POST。

此外,将自定义分析器添加到现有索引还需要将allowIndexDowntime设置为true。

https://[search service name].search.windows.net/indexes/[index name]?api-version=[api-version]&allowIndexDowntime=true

您可以在'add custom analyzers'文档中找到更多信息。

© www.soinside.com 2019 - 2024. All rights reserved.