You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the problem including expected versus actual behavior:
Question 1.
When creating a suggestion field and setting Contexts, the following methods do not take effect:
`
.Completion(t => t.Suggestions, //Settings not effective
t => t.Analyzer("suggest_analyzer")
.Contexts(c => c
.Type("CATEGORY")
.Name("merchantTab")
.Path(cp => cp.MerchantId.Suffix("tab"))
)
)
`
The following methods are effective:
`
.Completion(t => t.Suggestions, //Setting is valid
t => t.Analyzer("suggest_analyzer")
.Contexts(new SuggestContext[] {
new SuggestContext
{
Type = "CATEGORY",
Name = $"merchantTab",
Path = new Field("merchantId.tab")
}
})
)
`
Question 2.
Suggest doesn't work and won't get any results,But I used the same data, and there were results in Elasticsearch 7.17.5:
`
public async Task<object> Suggest(string input)
{
var suggester = FieldSuggester.Completion(new CompletionSuggester
{
Contexts = new Dictionary<Field, ICollection<CompletionContext>> {
{"merchantTab", new List<CompletionContext>{ new CompletionContext {
Context=new Context (""),
Prefix=true,
} } }
},
Fuzzy = new SuggestFuzziness
{
Fuzziness = new Fuzziness("auto"),
MinLength = 1,
PrefixLength = 2,
Transpositions = true,
UnicodeAware = false
},
Field = "suggestions",
Size = 10,
SkipDuplicates = true,
});
suggester.Prefix = input;
//suggester.Text = input;
string name = "product-suggest";
var result = await _elasticClient.SearchAsync<ProductInfoDoc8>(m => m
.Index("frame.product8x")
.Suggest(new Suggester
{
Suggesters = new Dictionary<string, FieldSuggester> {
{ name, suggester}
}
}
));
return result.Fields.FirstOrDefault();
}
`
The text was updated successfully, but these errors were encountered:
This looks like a bug. The descriptor functionality should be equivalent to the object initializer syntax.
The Suggestion property that contains the suggestion results, is currently missing from the search response. I re-implemented this functionality in Reintroduce suggestion feature #7894 which will be included in the next release.
Elastic.Clients.Elasticsearch version:8.9.2
Elasticsearch version:8.7.0
.NET runtime version:net7.0
Operating system version:win11
Description of the problem including expected versus actual behavior:
Question 1.
When creating a suggestion field and setting Contexts, the following methods do not take effect:
`
.Completion(t => t.Suggestions, //Settings not effective
t => t.Analyzer("suggest_analyzer")
.Contexts(c => c
.Type("CATEGORY")
.Name("merchantTab")
.Path(cp => cp.MerchantId.Suffix("tab"))
)
)
`

The following methods are effective:
`
.Completion(t => t.Suggestions, //Setting is valid
t => t.Analyzer("suggest_analyzer")
.Contexts(new SuggestContext[] {
new SuggestContext
{
Type = "CATEGORY",
Name = $"merchantTab",
Path = new Field("merchantId.tab")
}
})
)
`
Question 2.
Suggest doesn't work and won't get any results,But I used the same data, and there were results in Elasticsearch 7.17.5:
`
`
The text was updated successfully, but these errors were encountered: