Skip to content

Releases: elastic/elasticsearch-net

9.1.8

25 Sep 12:40
81cebf5
Compare
Choose a tag to compare

What's Changed

Breaking Changes

The type of the Sources property has been changed from ICollection<IDictionary<string, CompositeAggregationSource>> to ICollection<KeyValuePair<string, CompositeAggregationSource>>. This corresponds to the Elasticsearch standard for modeling ordered dictionaries in the REST API.

CompositeAggregationSource is now also a container (similar to Aggregation, Query, etc.). This change improves usability due to specialized code generation. For example, implicit conversion operators from all existing variants (CompositeTermsAggregation, CompositeHistogramAggregation, etc.) to CompositeAggregationSource are now generated.

As a consequence, the object initializer syntax changes as follows:

// 9.1.7 and below

var request = new SearchRequest
{
    Aggregations = new Dictionary<string, Aggregation>
    {
        { "my_composite", new CompositeAggregation
        {
            Sources =
            [
                new Dictionary<string, CompositeAggregationSource>
                {
                    { "my_terms", new CompositeAggregationSource
                    {
                        Terms = new CompositeTermsAggregation
                        {
                            // ...
                        }
                    }}
                },
                new Dictionary<string, CompositeAggregationSource>
                {
                    { "my_histo", new CompositeAggregationSource
                    {
                        Histogram = new CompositeHistogramAggregation(0.5)
                        {
                            // ...
                        }
                    }}
                }
            ]
        }}
    }
};

// 9.1.8 and above

var request = new SearchRequest
{
    Aggregations = new Dictionary<string, Aggregation>
    {
        { "my_composite", new CompositeAggregation
        {
            Sources =
            [
                new KeyValuePair<string, CompositeAggregationSource>(
                    "my_terms",
                    // Implicit conversion from `CompositeTermsAggregation` to `CompositeAggregationSource`.
                    new CompositeTermsAggregation
                    {
                        // ...
                    }
                ),
                new KeyValuePair<string, CompositeAggregationSource>(
                    "my_histo",
                    // Implicit conversion from `CompositeHistogramAggregation` to `CompositeAggregationSource`.
                    new CompositeHistogramAggregation(0.5) <2>
                    {
                        // ...
                    }
                )
            ]
        }}
    }
};

In addition, this change allows optimized Fluent syntax to be generated, which ultimately avoids a previously existing ambiguity:

// 9.1.7 and below

var descriptor = new SearchRequestDescriptor()
    .Aggregations(aggs => aggs
        .Add("my_composize", agg => agg
            .Composite(composite => composite
                // This is the `params` overload that initializes the `Sources` collection with multiple entries.
                .Sources(
                    // Add dictionary item 1 that contains a single `Terms` aggregation entry.
                    x => x.Add("my_terms", x => x.Terms(/* ... */)),
                    // Add dictionary item 2 that contains a single `Histogram` aggregation entry.
                    x => x.Add("my_histo", x => x.Histogram(/* ... */)) <3>
                )
            )
        )
    );

// 9.1.8 and above

var descriptor = new SearchRequestDescriptor()
    .Aggregations(aggs => aggs
        .Add("my_composize", agg => agg
            .Composite(composite => composite
                .Sources(sources => sources
                    .Add("my_terms", x => x.Terms(/* ... */))
                    .Add("my_histo", x => x.Histogram(/* ... */))
                )
            )
        )
    );

The old syntax was tricky because the 9.1.8 example also compiled successfully, but the .Add referred to the first dictionary both times. This ultimately resulted in a list with only one dictionary, which had multiple entries, and thus an invalid request.


Full Changelog: 9.1.7...9.1.8

8.19.7

25 Sep 12:45
59f8977
Compare
Choose a tag to compare

What's Changed

Breaking Changes

See https://github.com/elastic/elasticsearch-net/releases/tag/9.1.8.


Full Changelog: 8.19.6...8.19.7

9.1.7

11 Sep 15:00
40ce798
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 9.1.6...9.1.7

8.19.6

11 Sep 15:01
7da1703
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 8.19.5...8.19.6

9.1.6

29 Aug 12:52
5197a92
Compare
Choose a tag to compare

What's Changed

Full Changelog: 9.1.5...9.1.6

8.19.5

29 Aug 12:51
3cca372
Compare
Choose a tag to compare

What's Changed

Full Changelog: 8.19.4...8.19.5

9.1.5

19 Aug 12:28
ad4808a
Compare
Choose a tag to compare

What's Changed

  • Introduce RequestResponseConverter<T> and make all non-generated JsonConverters public by @flobernd in #8669
    • Greatly simplifies use of Elastic.Clients.Elasticsearch types in documents (e.g. for percolation; see #8003)
  • Regenerate client by @flobernd in #8679
  • Update Elastic.Transport to 0.10.1 by @flobernd in #8681
    • Fixes a race condition (see #8671)

Full Changelog: 9.1.4...9.1.5

8.19.4

19 Aug 12:29
d539a57
Compare
Choose a tag to compare

What's Changed

  • Introduce RequestResponseConverter<T> and make all non-generated JsonConverters public by @flobernd in #8669
    • Greatly simplifies use of Elastic.Clients.Elasticsearch types in documents (e.g. for percolation; see #8003)
  • Regenerate client by @flobernd in #8679
  • Update Elastic.Transport to 0.10.1 by @flobernd in #8681
    • Fixes a race condition (see #8671)

Full Changelog: 8.19.3...8.19.4

9.1.4

13 Aug 12:18
56b87ad
Compare
Choose a tag to compare

What's Changed

Full Changelog: 9.1.3...9.1.4

8.19.3

13 Aug 12:19
e0e135f
Compare
Choose a tag to compare

What's Changed

Full Changelog: 8.19.2...8.19.3