Help on using suggestions on java client 8.1.3 search

Hello,
I am trying to search with suggestion using the Java Client.
In my first approach I write the code:

client.search(request -> request.
index(indexName).
suggest(suggest -> suggest.suggesters("suggest", value -> value.
term(v -> v.
field("ocr_text").maxTermFreq(Float.valueOf("10")).suggestMode(SuggestMode.Always))).text("test")), HashMap.class);

The request crashes on client with error:

co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch.core.search.TermSuggest: co.elastic.clients.json.UnexpectedJsonEventException: Unexpected JSON event 'START_ARRAY' instead of '[START_OBJECT, KEY_NAME]' (JSON path: suggest['term#suggest'][0].options) (line no=1, column no=236, offset=-1)
at co.elastic.clients.json.JsonpMappingException.from0(JsonpMappingException.java:134)

The client java release is 8.1.3.

Many thanks

Ciao,
Matteo

You may be hitting TermSuggest options should be an array · Issue #214 · elastic/elasticsearch-java · GitHub (or something similar). Can you add a comment to the issue please?

Hello,
ok.

thanks

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