[英]ElasticSearch - Nest - creating a template
I am using ElasticSearch
version 6.4.1
and I am using it from my C#
application using Nest
library version 6.1.0
. 我正在使用
ElasticSearch
6.4.1
版,并且正在使用Nest
库版本6.1.0
C#
应用程序中使用它。
I an trying to create an Index Template
using Nest
without success. 我试图使用
Nest
创建Index Template
而没有成功。
The only documentation I found if this old documentation: Nest Templates 如果找到这个旧文档,我会找到唯一的文档: 嵌套模板
I can't find any documentation for the newer versions. 我找不到较新版本的任何文档。
I did notice they have a method named PutIndexTemplate
for the ElasticClient
but again I can't find any documentation or examples on how to use it 我注意到他们有一个名为方法
PutIndexTemplate
为ElasticClient
而我又无法找到如何使用它的任何文件或实例
I have seen this post: nst template example but looks like its broken as I get an compilation error on .Template
我看过这篇文章: nst模板示例,但是当我在
.Template
上收到编译错误时,它看起来好像坏了
Ok I found the way it's done: 好的,我找到了完成的方式:
var putIndexTemplateResponse = m_ElasticClient.PutIndexTemplate("server_alerts", t => t
.IndexPatterns("server_alerts*")
.Mappings(m => m
.Map("alert", tm => tm
.Properties(p => p
.Keyword(k => k
.Name("id")
)
)
)
)
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.