2017-02-20 68 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(..)