Hi,
I am referring to this and am able to perform a fuzzy search with query_string in kibana.
In kibana "salry~" is being searched and it returns results with "salary" due to ~ operator for fuzziness.
GET help/_search
{"_source":{
"excludes": ["id","prod","desc","html"]},
"from": 0,
"size": 25,
"query": {
"bool": {
"should": [
{"query_string": {
"query": "salry~",
"fields": ["title.title_exact"]
, "fuzziness": "3"
, "fuzzy_prefix_length": 3
}},
{"query_string": {
"query": "salry~",
"fields": ["title"]
, "fuzziness": "3"
, "fuzzy_prefix_length": 3
}}
]
}}}
However, can you help me with the corresponding .Nest Fluent DSL as what I have currently does not apply fuzziness - the result set returned is empty as there are no matches for "salry"
{
return _client.Search<SearchAutocompModel>(s => s
.Source(sf => sf
.Excludes(i => i
.Fields(p => p.Desc, p => p.Prod, p => p.Id, p => p.Html)))
.From(0)
.Size(25)
.Query(q => q
.Bool(b => b
.Should(s => s
.QueryString(c => c
.Query(keyword)
.Boost(2)
.Fields(f => f
.Field(p => p.Title.Suffix("title_exact")))
.Fuzziness(Fuzziness.Auto)
.FuzzyPrefixLength(3)),
s => s
.QueryString(c => c
.Query(keyword)
.Fields(f => f
.Field(p => p.Title))
.Fuzziness(Fuzziness.Auto)
.FuzzyPrefixLength(3)))))
);
}
Thanks!