Using CompletionSuggestionBuilder with context in Java


(Cosmin Marginean) #1

Hi guys

I'm trying to use the CompletionSuggestionBuilder (context suggester) with the Java client (ES 5.0.1), and I'm struggling with adding contexts, and the API is not entirely clear on that.

This is as far as I got, but again, only by intuitively surfing the API, not really sure if this is the right way to go about it, as documentation is scarce in this area.

CompletionSuggestionBuilder completion = new CompletionSuggestionBuilder(FIELD_SUGGEST)
        .prefix(text);
Map<String, List<? extends ToXContent>> contexts = new HashMap<>();
    
???
    
completion.contexts(contexts);

Also, methods on CompletionSuggestionBuilder.Contexts2x seem to be all deprecated, which I presume is not the route to pursue.

Thanks
Cos


(system) #2

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