C# ElasticSearch-无法使用Nest客户端创建映射
我正在使用for Elastic搜索为我的一个索引创建映射。我有这个方法,它应该在索引“business”上创建映射,但无论我如何更改它,映射都不会被创建C# ElasticSearch-无法使用Nest客户端创建映射,c#,indexing,
elasticsearch,mapping,C#,Indexing,
elasticsearch,Mapping,我正在使用for Elastic搜索为我的一个索引创建映射。我有这个方法,它应该在索引“business”上创建映射,但无论我如何更改它,映射都不会被创建 public void CreateIndexWithMappings() { var mapping= client.CreateIndex("business", index => index .AddMapping<BusinessSearchDto>(m => m
public void CreateIndexWithMappings()
{
var mapping= client.CreateIndex("business", index => index
.AddMapping<BusinessSearchDto>(m => m
.Properties(props => props
.Completion (c => c
.Name(x => x.Name.Suffix("completion"))
.IndexAnalyzer("analyzer_startswith")
.SearchAnalyzer("analyzer_startswith")
.MaxInputLength(30)
.Payloads(true)
.PreservePositionIncrements()
.PreserveSeparators()
)
)));
}
public void CreateIndexWithMappings()
{
var mapping=client.CreateIndex(“业务”,index=>index
.AddMapping(m=>m
.Properties(props=>props
.完成(c=>c
.Name(x=>x.Name.Suffix(“完成”))
.IndexAnalyzer(“analyzer_startswith”)
.SearchAnalyzer(“analyzer_startswith”)
.MaxInputLength(30)
.有效载荷(真实)
.分隔符()
)
)));
}
创建上述映射后,我将业务索引到新创建的“业务”索引
var indexMany=client.indexMany(businessDtos,“business”);
当我执行curl-XGET时http://localhost/business/businesssearchdto/_mapping
要检查映射,我发现映射未创建
我看过NEST客户的例子,还有很多其他的问题,所以我没有主意。谢谢你的帮助 你能提供你想要创建的映射吗???@BlackPOP,这真的没关系。如果你能给我一个使用NEST客户端新的fluent接口创建映射的例子,那应该很好,因为我尝试创建的映射都不起作用。具体来说,我正在尝试在
http://localhost:9200/business/businesssearchdto
var indexMany = client.IndexMany<BusinessSearchDto>(businessDtos, "business");