elasticsearch的CreateIndex在将版本从2.3.3更改为5.4后,不会创建索引

时间:2017-05-18 06:47:13

标签: elasticsearch nest elasticsearch-plugin

我有一个应用程序在Elasticsearch 2.3.3中使用mapper-attachments。现在我升级到elasticsearch5.4。我使用Nest客户端来创建索引和索引数据。 现在索引不起作用。

我的索引代码是

var filters = new List<string> { "lowercase", "snowball", "nGram" }; 
        client.CreateIndex("mydocs", c => c
             .Settings(st => st
                       .Analysis(anl => anl
                       .Analyzers(h => h
                           .Custom("full", ff => ff
                                .Filters(filters)
                                .Tokenizer("standard"))
                           )
                           .TokenFilters(ba => ba
                               .Snowball("snowball", sn => sn
                                   .Language(SnowballLanguage.English)))
                           .TokenFilters(bases => bases
                           .EdgeNGram("nGram", gram => gram
                           .MaxGram(20)
                           .MinGram(3)
                           .Side(EdgeNGramSide.Front)
                           ))
                           )
                           .Setting("index.query.default_field", "file.content")
                           )

                        .Mappings(mp => mp
                        .Map<IndexDocument>(ms => ms
                        .AutoMap()
                        .Properties(ps => ps
                            .Nested<ES.SearchEngine.Models.Attachment>(n => n
                                .Name(sc => sc.File)
                            .AutoMap()
                            ))
                       .Properties(at => at
                       .Attachment(a => a.Name(o => o.File)
                       .FileField(fl => fl.Analyzer("full").TermVector(TermVectorOption.WithPositionsOffsets).Store())
                       .TitleField(t => t.Name(x => x.Title)
                       .Analyzer("full")
                       .TermVector(TermVectorOption.WithPositionsOffsets)
                       )))                           
                       ))
                       );

错误

  {Type: mapper_parsing_exception Reason: "Failed to parse mapping [indexdocument]: No handler for type [attachment] declared on field [file]" CausedBy: "Type: mapper_parsing_exception Reason: "No handler for type [attachment] declared on field [file]""}

任何人都可以帮忙。

0 个答案:

没有答案