Closed
Description
Java API client version
8.16.1
Java version
OpenJDK Runtime Environment Temurin-21.0.2+13
Elasticsearch Version
8.14.3
Problem description
Hello,
It seems like the fromJson method on the FuncitonScoreQuery object works differently with the latest client.
In our test setup we are using a function like this to create a query fixture from a supplied json which worked fine before the upgrade of the Java client, from 8.14.1 -> 8.16.1.
public static FunctionScoreQuery functionScoreQueryFromFile(String fileContent) {
return FunctionScoreQuery.of(q1 -> q1.withJson(new StringReader(fileContent))));
}
The use case that we are having problems with is when we have a nested function score query like this:
{
"functions": [
{
"field_value_factor": {
...
}
}
],
"query": {
"function_score": {
"query": {
...
}
}
}
}
And we get the following error:
co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch._types.query_dsl.FunctionScore: Unknown field 'query' (JSON path: query.function_score.query)
Is this use case not valid anymore?