2013-10-14 39 views
1

更新到NEST 0.11.5後,好像NEST.ElasticClient.MapRaw.CreateIndexRaw方法不再受支持。他們是否已被重新命名或移動或完全消失?ElasticClient.MapRaw和.CreateIndexRaw消失了嗎?

如果它們不存在,我怎樣才能定義索引創建的自定義分析設置?這是我試過的:

var indexSettings = new IndexSettings() 
    { 
     NumberOfReplicas = 1, 
     NumberOfShards = 2, 
     Analysis = new AnalysisSettings() // doesn't work, no setter 
      { 
       // here's where my settings would go... 
      } 
    }; 

var response = elasticClient.CreateIndex(indexName, indexSettings); 

由於沒有爲IndexSettings.Analysis定義setter,因此不起作用。

回答

2

原始通話已被推到elasticClient.Raw.CreateIndexPost(...)

對於0.11.5.0版本,我創建了自己的腳本來掃描elasticsearch源代碼以生成所有原始調用。出乎意料的是,elasticsearch開發人員也這樣做了,因此在0.11.6.0版本中IRawElasticClient簽名可能會再次發生變化,因爲NEST將與新的低級別客戶端準則兼容。

此外,一定要檢查出MapFluent()呼叫雖然

https://github.com/Mpdreamz/NEST/blob/master/src/Nest.Tests.Unit/Core/Map/FluentMappingFullExampleTests.cs

而且CreateIndex()也暴露了一個完全映射流利變種

https://github.com/Mpdreamz/NEST/blob/master/src/Nest.Tests.Integration/Indices/Analysis/Analyzers/AnalyzerTests.cs#L19

+0

YEPP的作品。謝謝! – Max