我正在尝试将这个特定的查询重写为C# NEST,但我被困在定义过滤器上了……我很困惑..。
{
"settings":{
"analysis":{
"filter":{
"lemmagen_filter_sk":{
"type":"lemmagen",
"lexicon":"sk"
},
"synonym_filter":{
"type":"synonym",
"synonyms_path":"synonyms/sk_SK.txt",
"ignore_case":true
},
"stopwords_SK":{
"type":"stop",
"stopwords_path":"stop-‐words/stop‐words-slovak.txt",
"ignore_case":true
}
},
"analyzer":{
"slovencina_synonym":{
"type":"custom",
"tokenizer":"standard",
"filter":[
"stopwords_SK",
"lemmagen_filter_sk",
"lowercase",
"stopwords_SK",
"synonym_filter",
"asciifolding"
]
},
"slovencina":{
"type":"custom",
"tokenizer":"standard",
"filter":[
"stopwords_SK",
"lemmagen_filter_sk",
"lowercase",
"stopwords_SK",
"asciifolding"
]
},我希望有正确的client.CreateIndex(...)具有正确索引设置的命令。我现在知道的就是:
client.CreateIndex(indexName, c => c
.InitializeUsing(indexConfig)
.Mappings(m => m
.Map<T>(mp => mp.AutoMap())));我找不到任何关于如何做到这一点的信息。我将非常感谢任何形式的帮助。
编辑:
client.CreateIndex(indexName, c => c
.InitializeUsing(indexConfig)
.Settings(s => s
.Analysis(a => a
.TokenFilters(t => t
.UserDefined("lemmagen_filter_sk",
new LemmagenTokenFilter { Lexicon = "sk" })
.Synonym("synonym_filter", ts => ts
.SynonymsPath("synonyms/sk_SK.txt")
.IgnoreCase(true))
.Stop("stopwords_sk", tst => tst
.StopWordsPath("stop-words/stop-words-slovak")
.IgnoreCase(true))
)
.Analyzers(aa => aa
.Custom("slovencina_synonym", acs => acs
.Tokenizer("standard")
.Filters("stopwords_SK", "lemmagen_filter_sk", "lowercase", "stopwords_SK", "synonym_filter", "asciifolding")
)
.Custom("slovencina", acs => acs
.Tokenizer("standard")
.Filters("stopwords_SK", "lemmagen_filter_sk", "lowercase", "stopwords_SK", "asciifolding")
)
)
)
)
.Mappings(m => m
.Map<DealItem>(mp => mp.AutoMap()
.Properties(p => p
.Text(t => t
.Name(n => n.title_dealitem)
.Name(n => n.coupon_text1)
.Name(n => n.coupon_text2)
.Analyzer("slovencina_synonym")
)
))));这就是我现在所拥有的,但是在尝试使用它之后,我得到了错误。
POST dealitems/_analyze
{
"analyzer": "slovencina",
"text": "Janko kúpil nové topánky"
}错误:
{
"error": {
"root_cause": [
{
"type": "remote_transport_exception",
"reason": "[myNode][127.0.0.1:9300][indices:admin/analyze[s]]"
}
],
"type": "illegal_argument_exception",
"reason": "failed to find analyzer [slovencina]"
},
"status": 400
}GET _settings没有显示任何分析器
结果:问题出在缺少files...wrong路径上
https://stackoverflow.com/questions/47645195
复制相似问题