如何使用 ElasticSearch Nest Version 7.x 创建 IndexTemplate

How do I create an IndexTemplate using ElasticSearch Nest Version 7.x

Elasticsearch Nest 版本 6.5.1 具有方法:IElastiClient.PutIndexTemplateAsync 允许创建 IndexTemplate。

我刚刚升级到 Elasticsearch Nest 版本 7.4.0,这个方法已经被删除,没有给出关于替换的指导。请有人解释如何使用 Elasticsearch NET API 版本 7.4.0.

创建索引模板

此方法与其他与索引操作相关的方法已移入 client.Indices

await client.Indices.PutTemplateAsync(..)

您可以在 official blog post (see "Namespaced API methods and Upgrade Assistant" section). Furthermore, you can install NEST.7xUpgradeAssistant 包中阅读更多关于此更改的原因,这将帮助您从 6.x 过渡到 7.x。

希望对您有所帮助。