Closed SwonVIP closed 1 month ago
8.13.2
OpenJDK Runtime Environment Temurin-21.0.2+13
8.6.2
Hello,
it seems like the fromJson method on the Aggregation and Query objects work differently and the Builders returned work a bit different.
In our test setup we are using a function like this to create a query fixture from a supplied json which works fine:
public static Query createQueryFromFile(String fileContent) { return Query.of(q1 -> q1.withJson(new StringReader(fileContent))); }
However doing the same for aggregations results in a type error:
public static Aggregation createAggregationFromFile(String fileContent) { return Aggregation.of(agg1 -> agg1.withJson(new StringReader(fileContent))); }
Bad return type in lambda expression: Builder cannot be converted to ObjectBuilder
So it seems the interface is different although to me as a consumer they should work in a similar way?
Hello, thank you for reporting this! Yes in theory it should work the same, we'll investigate on this.
Java API client version
8.13.2
Java version
OpenJDK Runtime Environment Temurin-21.0.2+13
Elasticsearch Version
8.6.2
Problem description
Hello,
it seems like the fromJson method on the Aggregation and Query objects work differently and the Builders returned work a bit different.
In our test setup we are using a function like this to create a query fixture from a supplied json which works fine:
However doing the same for aggregations results in a type error:
Bad return type in lambda expression: Builder cannot be converted to ObjectBuilder
So it seems the interface is different although to me as a consumer they should work in a similar way?