1
に私はこれを行うことができました私はNest 2.xで同じことをする方法を見つけることができません)巣のCopyTo、トークナイザとAnalyzerは巣の古いバージョンで2.xの
.. MapFromAttributesの代わりにAutoMapを使用する必要がありますが、正しく設定する方法がわかりません。 Analyzer、Tokenizer、およびCopyTo関数を使用します。
これは私がこれまで持っているすべてです:
var customerSearchIdxDesc = new CreateIndexDescriptor(Constants.ElasticSearch.CustomerSearchIndexName)
.Mappings(ms => ms.Map<SO.Services.Data.ServiceModel.DtoTypes.Customer.SearchResult>(m => m.AutoMap()));
var response = client.CreateIndex(customerSearchIdxDesc);
更新
近いと思う行き方:/
var customerSearchIdxDesc = new CreateIndexDescriptor(Constants.ElasticSearch.CustomerSearchIndexName)
.Settings((f) =>
{
return f.Analysis(analysis => analysis
.Analyzers(analyzers => analyzers
.Custom("search_ngram_analyzer", a => a
.Filters("lowercase")
.Tokenizer("search_ngram_tokenizer")))
.Tokenizers(tokenizers => tokenizers
.NGram("search_ngram_tokenizer", t => t
.MinGram(2)
.MaxGram(500)
.TokenChars(TokenChar.Digit, TokenChar.Letter, TokenChar.Punctuation, TokenChar.Punctuation, TokenChar.Symbol))));
})
.Mappings(ms => ms.Map<SO.Services.Data.ServiceModel.DtoTypes.Customer.SearchResult>(m => m.AutoMap()));
Documentatですion for 2.xはhttps://www.elastic.co/guide/en/elasticsearch/client/net-api/2.x/index.htmlにあり、https://www.elastic.coのオートドキュメントがあります。 /guide/ja/elasticsearch/client/net-api/2.x/auto-map.html。アナライザのいくつかのドキュメントは素晴らしい追加されます:) –