Skip to content

Commit da044ef

Browse files
author
Jörg Battermann
committed
Added Min/MaxChildren to HasChildFilterDescriptor
.. correspondingly as it was implemented in HasChildQueryDescriptor.cs
1 parent 06fa1ed commit da044ef

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

src/Nest/DSL/Filter/HasChildFilterDescriptor.cs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ public interface IHasChildFilter : IFilter
1313
[JsonProperty("type")]
1414
TypeNameMarker Type { get; set; }
1515

16-
[JsonProperty("query")]
16+
[JsonProperty("min_children")]
17+
int? MinChildren { get; set; }
18+
19+
[JsonProperty("max_children")]
20+
int? MaxChildren { get; set; }
21+
22+
[JsonProperty("query")]
1723
IQueryContainer Query { get; set; }
1824

1925
[JsonProperty("filter")]
@@ -34,7 +40,9 @@ protected internal override void WrapInContainer(IFilterContainer container)
3440
}
3541

3642
public TypeNameMarker Type { get; set; }
37-
public IQueryContainer Query { get; set; }
43+
public int? MinChildren { get; set; }
44+
public int? MaxChildren { get; set; }
45+
public IQueryContainer Query { get; set; }
3846
public IFilterContainer Filter { get; set; }
3947
public IInnerHits InnerHits { get; set; }
4048
}
@@ -57,7 +65,11 @@ bool IFilter.IsConditionless
5765

5866
TypeNameMarker IHasChildFilter.Type { get; set; }
5967

60-
IQueryContainer IHasChildFilter.Query { get; set; }
68+
int? IHasChildFilter.MinChildren { get; set; }
69+
70+
int? IHasChildFilter.MaxChildren { get; set; }
71+
72+
IQueryContainer IHasChildFilter.Query { get; set; }
6173

6274
IFilterContainer IHasChildFilter.Filter { get; set; }
6375

@@ -87,8 +99,20 @@ public HasChildFilterDescriptor<T> Type(string type)
8799
Self.Type = type;
88100
return this;
89101
}
90-
91-
public HasChildFilterDescriptor<T> InnerHits()
102+
103+
public HasChildFilterDescriptor<T> MinChildren(int minChildren)
104+
{
105+
Self.MinChildren = minChildren;
106+
return this;
107+
}
108+
109+
public HasChildFilterDescriptor<T> MaxChildren(int maxChildren)
110+
{
111+
Self.MaxChildren = maxChildren;
112+
return this;
113+
}
114+
115+
public HasChildFilterDescriptor<T> InnerHits()
92116
{
93117
Self.InnerHits = new InnerHits();
94118
return this;

0 commit comments

Comments
 (0)