Error deserializing Phrase Suggester - Java API Client

Hi everyone.

I'm implementing the Phrase Suggester in the Java API Client, the error below occurs:

[Request processing failed; nested exception is co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch.core.search.PhraseSuggest: co.elastic.clients.json.UnexpectedJsonEventException: Unexpected JSON event 'START_ARRAY' instead of '[START_OBJECT, KEY_NAME]' (JSON path: suggest['phrase#did_you_mean'][0].options) (line no=1, column no=243, offset=-1)] with root cause

co.elastic.clients.json.UnexpectedJsonEventException: Unexpected JSON event 'START_ARRAY' instead of '[START_OBJECT, KEY_NAME]'

Code:

 Map<String, FieldSuggester> map = new HashMap<>();
    map.put(Suggest.DID_YOU_MEAN, FieldSuggester.of(fs -> fs.phrase(p ->
            p.maxErrors(2.0).size(5).field("title.suggest")
        )
    ));
    Suggester suggester = Suggester.of(sg -> sg
        .suggesters(map)
        .text(term)
    );
    builder.suggest(suggester);

Is it an API bug or am I doing something wrong?

Extra info:
ElasticSearch Java v8.3.1

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