[英]What is the replacement for FuzzyMinimumSimilarity in Nest 2, Elasticsearch 2.3?
I'm upgrading to Nest 2 (elasticsearch 1.x to 2.3), but notice on breaking changes that FuzzyMinimumSimilarity and OnFieldsWithBoost are gone.我正在升级到 Nest 2(elasticsearch 1.x 到 2.3),但请注意 FuzzyMinimumSimilarity 和 OnFieldsWithBoost 的破坏性更改。 How should i replace this code below to Nest v2?我应该如何将下面的代码替换为 Nest v2?
new SearchDescriptor<T>().Type(searchTypes).Query(q =>q.QueryString(qs => qs.Query(fuzzy).FuzzyMinimumSimilarity(0.7)));
And for FuzzyMaxExpansions(0.7)
而对于FuzzyMaxExpansions(0.7)
Here are the fuzziness options available on query_string
query in NEST 2.x (use latest 2.5.8)以下是NEST 2.x 中query_string
查询可用的模糊选项(使用最新的 2.5.8)
var client = new ElasticClient();
var searchResponse = client.Search<MyDocument>(s => s
.Query(q => q
.QueryString(qs =>qs
.Fields(f => f
.Field(ff => ff.Name, 3)
.Field(ff => ff.Content, 0.5)
)
.Query("fuzzy")
.Fuzziness(Fuzziness.EditDistance(3))
.FuzzyMaxExpansions(2)
.FuzzyPrefixLength(4)
.FuzzyRewrite(MultiTermQueryRewrite.TopTerms(3))
)
)
);
which yields这产生
{
"query": {
"query_string": {
"query": "fuzzy",
"fuzzy_max_expansions": 2,
"fuzziness": 3,
"fuzzy_prefix_length": 4,
"fields": [
"name^3",
"content^0.5"
],
"fuzzy_rewrite": "top_terms_3"
}
}
}
Also take a look at the release blog post and breaking changes between 1.x and 2.x documentation另请查看发布博客文章和1.x 和 2.x文档之间的重大更改
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.