Are ElasticClient.MapRaw and .CreateIndexRaw gone?

南楼画角 提交于 2019-12-11 05:04:51

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!