Skip to content

Commit 6938f0f

Browse files
committed
ParentAggregation tests only valid in Elasticsearch 6.6.0+
This commit limits ParentAggregation tests to run only when targeting Elasticsearch 6.6.0+. Add documentation that highlights this.
1 parent 66cddbc commit 6938f0f

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/Nest/Aggregations/AggregationContainer.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ public interface IAggregationContainer
177177
[JsonProperty("nested")]
178178
INestedAggregation Nested { get; set; }
179179

180+
/// <inheritdoc cref="IParentAggregation"/>
180181
[JsonProperty("parent")]
181182
IParentAggregation Parent { get; set; }
182183

@@ -307,6 +308,7 @@ public class AggregationContainer : IAggregationContainer
307308

308309
public INestedAggregation Nested { get; set; }
309310

311+
/// <inheritdoc cref="IParentAggregation"/>
310312
public IParentAggregation Parent { get; set; }
311313

312314
public IPercentileRanksAggregation PercentileRanks { get; set; }
@@ -589,6 +591,7 @@ Func<NestedAggregationDescriptor<T>, INestedAggregation> selector
589591
) =>
590592
_SetInnerAggregation(name, selector, (a, d) => a.Nested = d);
591593

594+
/// <inheritdoc cref="IParentAggregation"/>
592595
public AggregationContainerDescriptor<T> Parent<TParent>(string name,
593596
Func<ParentAggregationDescriptor<T, TParent>, IParentAggregation> selector
594597
) where TParent : class =>

src/Nest/Aggregations/Bucket/Parent/ParentAggregation.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
namespace Nest
44
{
5+
/// <summary>
6+
/// A special single bucket aggregation that selects parent documents that
7+
/// have the specified type, as defined in a join field.
8+
/// </summary>
9+
/// <remarks>
10+
/// Valid only in Elasticsearch 6.6.0+
11+
/// </remarks>
512
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
613
[ContractJsonConverter(typeof(AggregationJsonConverter<ParentAggregation>))]
714
public interface IParentAggregation : IBucketAggregation
@@ -13,6 +20,7 @@ public interface IParentAggregation : IBucketAggregation
1320
RelationName Type { get; set; }
1421
}
1522

23+
/// <inheritdoc cref="IParentAggregation"/>
1624
public class ParentAggregation : BucketAggregationBase, IParentAggregation
1725
{
1826
internal ParentAggregation() { }
@@ -24,6 +32,7 @@ internal ParentAggregation() { }
2432
internal override void WrapInContainer(AggregationContainer c) => c.Parent = this;
2533
}
2634

35+
/// <inheritdoc cref="IParentAggregation"/>
2736
public class ParentAggregationDescriptor<T, TParent>
2837
: BucketAggregationDescriptorBase<ParentAggregationDescriptor<T, TParent>, IParentAggregation, TParent>, IParentAggregation
2938
where T : class

src/Tests/Tests/Aggregations/Bucket/Parent/ParentAggregationUsageTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ namespace Tests.Aggregations.Bucket.Parent
2020
*
2121
* Be sure to read the Elasticsearch documentation on {ref_current}/search-aggregations-bucket-parent-aggregation.html[Parent Aggregation].
2222
*/
23+
[SkipVersion("<6.6.0", "Parent aggregation only available in Elasticsearch 6.6.0+")]
2324
public class ParentAggregationUsageTests : ApiIntegrationTestBase<ReadOnlyCluster, ISearchResponse<CommitActivity>, ISearchRequest, SearchDescriptor<CommitActivity>, SearchRequest<CommitActivity>>
2425
{
2526
public ParentAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }

0 commit comments

Comments
 (0)