NEST是否支持更新索引分析

NEST是否支持更新索引分析

本文介绍了NEST是否支持更新索引分析?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如在elasticSearch文档中所述, ,可以为索引定义一个新的分析(我尝试了,它的工作正常)。



我想知道是否可以与NEST执行相同的操作?



我尝试过:

  ElasticClient.CloseIndex(myindex ); 
IndexSettings ndxSettings = ElasticClient.GetIndexSettings(myindex)。
ndxSettings.Analysis.Analyzers.Add(snbowball,新的SnowballAnalyzer());
var r = ElasticClient.UpdateSettings(myindex,ndxSettings);
ElasticClient.OpenIndex(myindex);

没有错误,但没有任何变化。



当我尝试看是否添加了分析器:

  var getResponse = ElasticClient.GetIndexSettings(myindex); 

getResponse.Settings.Analysis.Analyzers contains没有。

解决方案

你正在做正确的事情,但分析设置目前不在NEST中的UpdateWhiteList: p>


As written in the elasticSearch documentation here, it's possible to define a new analysis for an index (I tried and it worked fine).

I was wondering if it was possible to perform the same thing with NEST?

I tried this:

ElasticClient.CloseIndex("myindex");
IndexSettings ndxSettings = ElasticClient.GetIndexSettings("myindex").Settings;
ndxSettings.Analysis.Analyzers.Add("snbowball", new SnowballAnalyzer());
var r = ElasticClient.UpdateSettings("myindex", ndxSettings);
ElasticClient.OpenIndex("myindex");

No error but nothing has changed.

When I try to see if the analyser has been added:

var getResponse = ElasticClient.GetIndexSettings("myindex");

getResponse.Settings.Analysis.Analyzers contains nothing.

解决方案

You're doing the right thing, but analysis settings currently aren't on the UpdateWhiteList in NEST:

https://github.com/Mpdreamz/NEST/blob/master/src/Nest/Domain/Settings/IndexSettings.cs

这篇关于NEST是否支持更新索引分析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 11:20