Skip to content

v8.16.7

Compare
Choose a tag to compare
@l-trotta l-trotta released this 04 Apr 10:45
· 124 commits to main since this release

What's Changed

Bugfixes

  • Inference API: fixed getTrainedModels, which was broken as reported in #964 and #967, because of missing fields.

  • FunctionScoreQuery: our effort to support more shortcut properties (see #858) inadvertently broken deserialization for the standard syntax of FuncitonScoreQuery (as reported in #917 ), so we reverted those changes for this particular class.

Feature Preview

Since this is the last patch release for 8.16, we decided to preview some of the features that will be available in future versions of the client. None of these are breaking changes, they are all overloads of existing methods.

Default class for methods requiring TDocument

Some requests in the client require a second parameter to define the result class, for example search, meaning the compiler will complain while the query is being written, which can be annoying. We added overload methods that use Void.class as default type, so that the correct type can be eventually added later into writing the query.

Example with search:

  • Old:

    esClient.search(s -> s
        .index("my-index")
        .query(q -> q
            .matchAll(m -> m)
        )
    ,Object.class);
  • New:

    esClient.search(s -> s
        .index("my-index")
        .query(q -> q
            .matchAll(m -> m)
        )
    );

Builder setters overloads with variant type

Added more setters allowing to build requests with a specific type variant instead of having to use the parent class and then select the desired variant later.

Example with query, where the query field can now accept a MatchAllQuery (or any other variant) directly:

  • Old:
    esClient.search(s -> s
        .index("my-index")
        .query(q -> q
            .matchAll(m -> m)
        )
    );
  • New:
    esClient.search(s -> s
        .index("my-index")
        .query(MatchAllQuery.of(m -> m))
    );

Example with aggregations, where the aggregations field can now accept AverageAggregation (or any other variant) drectly:

  • Old:
    // using functional builder shortcut
    esClient.search(s -> s
        .aggregations("agg", a -> a
            .avg(av -> av
                .field("price"))
        )
    );
    
    // using Aggregation class builder
    esClient.search(s -> s
        .aggregations("agg", Aggregation.of(ag -> ag
            .avg(av -> av
                .field("price"))
            )
        )
    );
  • New:
    esClient.search(s -> s
        .aggregations("agg", AverageAggregation.of(av -> av
            .field("price"))
        )
    );

Full Changelog: v8.16.6...v8.16.7