Elastic Search Phrase Suggestion API

var response = await _client.SearchAsync(s => s
.Index($"{_config.ElasticIndex}")
.Suggest(ss => ss
.Phrase("simple_phrase",
ph => ph.Field(f => f.Name.Select(fn => fn.Text))
.Size(1)
.GramSize(10)
.DirectGenerator(dg => dg.Field(f => f.Name.Select(fn =>fn.Text))
.SuggestMode(Elasticsearch.Net.SuggestMode.Always))
.Highlight(hl => hl.PreTag("")
.PostTag("
")))));

IN ELASTIC SEARCH MY QUERY LOOKS LIKE THIS

POST local/_search
{
"suggest": {
"text": "DigmaLinxA12",
"simple_phrase": {
"phrase": {
"field": "name.text",
"size": 1,
"gram_size": 10,
"direct_generator": [ {
"field": "name.text",
"suggest_mode": "always"
} ],
"highlight": {
"pre_tag": "",
"post_tag": "
"
}
}
}
}
}

The problem in .net query is that i can not find Text field like i have in es query.

var response = await
_client.SearchAsync(s => s
.Index($"{_config.ElasticIndex}")
.Suggest(ss => ss
.Phrase("simple_phrase",
ph => ph.Field(f => f.Name.Select(fn => fn.Text))
.Text($"{term}") //...
.Size(1)
.GramSize(10)
.DirectGenerator(dg => dg.Field(f => f.Name.Select(fn =>fn.Text))
.SuggestMode(Elasticsearch.Net.SuggestMode.Always))
.Highlight(hl => hl.PreTag(" <em>")
.PostTag("</em> ")))));

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.