您可以在創建索引時定義分析儀。
public void CreateIndex(string indexName)
{
// Define the analyzer
var customAnalyzer = new CustomAnalyzer();
customAnalyzer.Tokenizer = "my_tokenizer"; // add a tokenizer
customAnalyzer.Filter = new List<string>();
customAnalyzer.Filter.ToList().Add("lowercase"); // add some filters
// Add the analyzer to your index settings
var request = new CreateIndexRequest(indexName);
request.Settings.Analysis.Analyzers = new Analyzers();
request.Settings.Analysis.Analyzers.Add("my_analyzer", customAnalyzer);
// Create the index
ElasticClient nestClient = new ElasticClient();
var indexResponse = nestClient.CreateIndex(request);
}