问题
After updating to NEST 0.11.5, it appears as if the NEST.ElasticClient.MapRaw and .CreateIndexRaw methods aren't supported anymore. Have they been renamed or moved or are they completely gone?
In case they're gone, how can I define custom analysis settings on index creation? This is what I've tried:
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);
Doesn't work since there's no setter defined for IndexSettings.Analysis.
回答1:
The Raw calls have been pushed down to elasticClient.Raw.CreateIndexPost(...).
For the 0.11.5.0 release i created my own script that scans the elasticsearch source code to generate all the raw calls. Appearantly the elasticsearch dev's have also done this so the IRawElasticClient signatures might changes again in the 0.11.6.0 release as NEST will be compatible with the new low level client guidelines.
Also be sure to check out the MapFluent() call though
https://github.com/Mpdreamz/NEST/blob/master/src/Nest.Tests.Unit/Core/Map/FluentMappingFullExampleTests.cs
And CreateIndex() also exposes a fully mapped fluent variant
https://github.com/Mpdreamz/NEST/blob/master/src/Nest.Tests.Integration/Indices/Analysis/Analyzers/AnalyzerTests.cs#L19
来源:https://stackoverflow.com/questions/19363377/are-elasticclient-mapraw-and-createindexraw-gone