[JAVA] Error deserializing TermSuggest

I am using the Java client in its version 8.2.0. When running my search I get a runtime error when I add the suggest and it happens when deserializing.

My code:

SearchResponse<Podcast> response = client.search(
                    s -> s.index("podcasts-test")
                            .query(q -> q.match(m -> m.field("clips.words.word")
                                                        .query(finalQuery)
                                                )
                            )
                            .explain(true)
                            .suggest(sug -> sug.text(finalQuery)
                                                .suggesters("suggestion",
                                                            sugg -> sugg.term(t -> t.field("clips.words.word"))
                                                            )
                            )
                    , Podcast.class
            );

The exception thrown:

Caused by: co.elastic.clients.json.UnexpectedJsonEventException: Unexpected JSON event 'START_ARRAY' instead of '[START_OBJECT, KEY_NAME]'
        at co.elastic.clients.json.JsonpUtils.ensureAccepts(JsonpUtils.java:103)
        at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:74)
        at co.elastic.clients.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:79)
        at co.elastic.clients.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:43)
        at co.elastic.clients.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:71)
        at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:180)
        ... 99 more

This is the petition I am trying to do with java:

GET podcasts-test/_search
{
  "query": {
      "match": {
        "clips.words.word": "my query"
      }
  },
  "explain": true,
  "suggest": {
    "suggestion": {
      "text": "my query",
      "term": {
        "field": "clips.words.word"
      }
    }
  }
}

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