Skip to content

Commit 1ab0b7b

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. (cherry picked from commit 6938f0f)
1 parent 511b36d commit 1ab0b7b

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
@@ -189,6 +189,7 @@ public interface IAggregationContainer
189189
[DataMember(Name = "nested")]
190190
INestedAggregation Nested { get; set; }
191191

192+
/// <inheritdoc cref="IParentAggregation"/>
192193
[DataMember(Name = "parent")]
193194
IParentAggregation Parent { get; set; }
194195

@@ -319,6 +320,7 @@ public class AggregationContainer : IAggregationContainer
319320

320321
public INestedAggregation Nested { get; set; }
321322

323+
/// <inheritdoc cref="IParentAggregation"/>
322324
public IParentAggregation Parent { get; set; }
323325

324326
public IPercentileRanksAggregation PercentileRanks { get; set; }
@@ -601,6 +603,7 @@ Func<NestedAggregationDescriptor<T>, INestedAggregation> selector
601603
) =>
602604
_SetInnerAggregation(name, selector, (a, d) => a.Nested = d);
603605

606+
/// <inheritdoc cref="IParentAggregation"/>
604607
public AggregationContainerDescriptor<T> Parent<TParent>(string name,
605608
Func<ParentAggregationDescriptor<T, TParent>, IParentAggregation> selector
606609
) where TParent : class =>

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

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

44
namespace Nest
55
{
6+
/// <summary>
7+
/// A special single bucket aggregation that selects parent documents that
8+
/// have the specified type, as defined in a join field.
9+
/// </summary>
10+
/// <remarks>
11+
/// Valid only in Elasticsearch 6.6.0+
12+
/// </remarks>
613
[InterfaceDataContract]
714
[ReadAs(typeof(ParentAggregation))]
815
public interface IParentAggregation : IBucketAggregation
@@ -14,6 +21,7 @@ public interface IParentAggregation : IBucketAggregation
1421
RelationName Type { get; set; }
1522
}
1623

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

36+
/// <inheritdoc cref="IParentAggregation"/>
2837
public class ParentAggregationDescriptor<T, TParent>
2938
: BucketAggregationDescriptorBase<ParentAggregationDescriptor<T, TParent>, IParentAggregation, TParent>, IParentAggregation
3039
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)