New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TermSuggest options should be an array #214
Comments
I've verified the same issue on my client, version 8.1.2 - Any requests using suggestion functionality need to be run through the old HLRC until this is fixed. |
Hi,
|
The same happens with 7.17.3 |
I have the same issue with 7.17.4 |
@jhnesk I don't believe there are any workarounds in-client at the moment. If you are transitioning from the old High Level Rest Client to the new Java client, you may need to continue using HLRC for suggestion based workloads until this is fixed up. @swallez Is there something that we should be looking at in the ES project regarding these response specifications to get this working? |
@jbaiera the definition of |
I created an issue in the specification repository: elastic/elasticsearch-specification#1775 |
Hello, |
Java API client version
8.1.1
Java version
11
Elasticsearch Version
8.1.0
Problem description
I try to execute a search requesting a term-suggester:
The result looks good:
But the Java Client is not happy, because it thinks that the "options"-field in the term-suggester's result should be an object rather than an array. This causes the following error:
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) ~[elasticsearch-java-8.1.1.jar:?]
This is probably due to the code-generation that this library uses. I think that the specification is incorrect.
Looking at the options of a completion-suggester (https://github.com/elastic/elasticsearch-specification/blob/7b8304b279b50f87239c0d83262a1f0fd2963a2a/specification/_global/search/_types/suggester.ts#L51):
And looking at the options of a term-suggester (https://github.com/elastic/elasticsearch-specification/blob/7b8304b279b50f87239c0d83262a1f0fd2963a2a/specification/_global/search/_types/suggester.ts#L65):
This looks wrong, the result that elasticsearch returns is clearly an Array of options.
PS: PhraseSuggest looks wrong too (https://github.com/elastic/elasticsearch-specification/blob/7b8304b279b50f87239c0d83262a1f0fd2963a2a/specification/_global/search/_types/suggester.ts#L58):
Cheers
Lukas
The text was updated successfully, but these errors were encountered: