2017-02-20 62 views
0

这里我试图在我的新索引中创建一个搜索分析器,但我在t.Text“类型为System的未处理异常中得到异常。 ArgumentException的”发生在Nest.dll 其他信息:对于TextPropertyDescriptor`1映射无法获得字段名”使用映射创建索引时的ElasticSearch异常(嵌套5.2.0)

 var response = client1.CreateIndex("index", n => n 

      .Settings(s => s 
       .NumberOfShards(10) 
       .NumberOfReplicas(10) 
       .Analysis(a => a 
           .TokenFilters(af=>af.EdgeNGram("autocompletefilter",e=>e.MinGram(1) 
                         .MaxGram(20))) 
           .Analyzers(an => an.Custom("autocomplete", ana => ana.Tokenizer("standard") 
                      .Filters("lowercase", "asciifolding", "standard"))))) 
      .Mappings(m=>m.Map("mytype",my=>my.Properties(t=>t.Text(te=>te.Analyzer("autocomplete") 
                      .SearchAnalyzer("standard")))))); 
+2

你没有任何名称定义的属性。尝试'TE => te.Name( “名称”)。分析仪(..)'。 – Rob

+1

此外,10个复制品装置10 **套10个主碎片即100碎片复制品碎片**。这可能是太多副本(除非你运行的是一个非常大的群集),所以考虑减少这个 –

+1

谢谢你的帮助。现在我试图在索引中搜索,但我不能使用分析器,请求[/ index/mytype/_search]包含无法识别的参数:[analyzer]“ – grlouk

回答

0

需要

 te => te.Name("name").Analyzer(..)