我将我的应用程序从Nest版本6.8更新到7.3,发现当前不支持AnalyzeAsync方法。什么是以下代码的替代品?

var analyzeRequest = new AnalyzeRequest(_elasticSearchSettings.PatentFamilyIndexName)
            {
                Analyzer = analyzer,
                Text = new[] {wordsList}
            };
var analyzeResponse = await ElasticClient.AnalyzeAsync(analyzeRequest)

最佳答案

借助NEST 7.x,API方法已被归入与Thery相关的功能范围内

var client = new ElasticClient();

var analyzeRequest = new AnalyzeRequest(_elasticSearchSettings.PatentFamilyIndexName)
{
    Analyzer = analyzer,
    Text = new[] { wordsList }
};

var analyzeResponse = await client.Indices.AnalyzeAsync(analyzeRequest);

这使NEST与REST API规范以及其他客户端中的分组保持一致。您可以read more about the changes in the 7.x release blog post

关于elasticsearch - NEST 7.x中的AnalyzeAsync的替代品是什么?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57866226/

10-12 15:37