-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix #3317 and #3322 add after_key support to composite aggregation re… #3367
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,20 @@ public class MultiBucketAggregate<TBucket> : IAggregate | |
public IReadOnlyCollection<TBucket> Buckets { get; set; } = EmptyReadOnly<TBucket>.Collection; | ||
} | ||
|
||
public class CompositeBucketAggregate : IAggregate | ||
{ | ||
public IReadOnlyDictionary<string, object> Meta { get; set; } | ||
|
||
public IReadOnlyCollection<CompositeBucket> Buckets { get; set; } = EmptyReadOnly<CompositeBucket>.Collection; | ||
|
||
/// <summary> | ||
/// The after_key is equals to the last bucket returned in the response before any filtering that could be done by Pipeline aggregations. | ||
/// If all buckets are filtered/removed by a pipeline aggregation, the after_key will contain the last bucket before filtering. | ||
/// </summary> | ||
/// <remarks> Valid for Elasticsearch 6.3.0+ </remarks> | ||
public IReadOnlyDictionary<string, object> AfterKey { get; set; } = EmptyReadOnly<string, object>.Dictionary; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
|
||
// Intermediate object used for deserialization | ||
public class BucketAggregate : IAggregate | ||
|
@@ -44,5 +58,6 @@ public class BucketAggregate : IAggregate | |
public IReadOnlyDictionary<string, object> Meta { get; set; } = EmptyReadOnly<string, object>.Dictionary; | ||
public long DocCount { get; set; } | ||
public long BgCount { get; set; } | ||
public IReadOnlyDictionary<string, object> AfterKey { get; set; } = EmptyReadOnly<string, object>.Dictionary; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,13 +32,13 @@ protected ApiIntegrationTestBase(TCluster cluster, EndpointUsage usage) : base(c | |
public override IElasticClient Client => this.Cluster.Client; | ||
protected override TInitializer Initializer => Activator.CreateInstance<TInitializer>(); | ||
|
||
[I] public async Task ReturnsExpectedStatusCode() => | ||
[I] public virtual async Task ReturnsExpectedStatusCode() => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doesn't look like this needs to be virtual? |
||
await this.AssertOnAllResponses(r => r.ApiCall.HttpStatusCode.Should().Be(this.ExpectStatusCode)); | ||
|
||
[I] public async Task ReturnsExpectedIsValid() => | ||
[I] public virtual async Task ReturnsExpectedIsValid() => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doesn't look like this needs to be virtual? |
||
await this.AssertOnAllResponses(r => r.ShouldHaveExpectedIsValid(this.ExpectIsValid)); | ||
|
||
[I] public async Task ReturnsExpectedResponse() => await this.AssertOnAllResponses(ExpectResponse); | ||
[I] public virtual async Task ReturnsExpectedResponse() => await this.AssertOnAllResponses(ExpectResponse); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doesn't look like this needs to be virtual? |
||
|
||
protected override Task AssertOnAllResponses(Action<TResponse> assert) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this were to derive from
MultiBucketAggregate<CompositeBucket>
, I think binary compatibility would be maintained.