From da044eff64e27a1fcd485d98f7c88c0abef1b33d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Battermann?= Date: Fri, 31 Jul 2015 13:00:51 +0200 Subject: [PATCH 1/2] Added Min/MaxChildren to HasChildFilterDescriptor .. correspondingly as it was implemented in HasChildQueryDescriptor.cs --- .../DSL/Filter/HasChildFilterDescriptor.cs | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/src/Nest/DSL/Filter/HasChildFilterDescriptor.cs b/src/Nest/DSL/Filter/HasChildFilterDescriptor.cs index 0ac0f7b7d46..cf932859b8a 100644 --- a/src/Nest/DSL/Filter/HasChildFilterDescriptor.cs +++ b/src/Nest/DSL/Filter/HasChildFilterDescriptor.cs @@ -13,7 +13,13 @@ public interface IHasChildFilter : IFilter [JsonProperty("type")] TypeNameMarker Type { get; set; } - [JsonProperty("query")] + [JsonProperty("min_children")] + int? MinChildren { get; set; } + + [JsonProperty("max_children")] + int? MaxChildren { get; set; } + + [JsonProperty("query")] IQueryContainer Query { get; set; } [JsonProperty("filter")] @@ -34,7 +40,9 @@ protected internal override void WrapInContainer(IFilterContainer container) } public TypeNameMarker Type { get; set; } - public IQueryContainer Query { get; set; } + public int? MinChildren { get; set; } + public int? MaxChildren { get; set; } + public IQueryContainer Query { get; set; } public IFilterContainer Filter { get; set; } public IInnerHits InnerHits { get; set; } } @@ -57,7 +65,11 @@ bool IFilter.IsConditionless TypeNameMarker IHasChildFilter.Type { get; set; } - IQueryContainer IHasChildFilter.Query { get; set; } + int? IHasChildFilter.MinChildren { get; set; } + + int? IHasChildFilter.MaxChildren { get; set; } + + IQueryContainer IHasChildFilter.Query { get; set; } IFilterContainer IHasChildFilter.Filter { get; set; } @@ -87,8 +99,20 @@ public HasChildFilterDescriptor Type(string type) Self.Type = type; return this; } - - public HasChildFilterDescriptor InnerHits() + + public HasChildFilterDescriptor MinChildren(int minChildren) + { + Self.MinChildren = minChildren; + return this; + } + + public HasChildFilterDescriptor MaxChildren(int maxChildren) + { + Self.MaxChildren = maxChildren; + return this; + } + + public HasChildFilterDescriptor InnerHits() { Self.InnerHits = new InnerHits(); return this; From f563f0315e8764373874ed330e320017e067d3d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Battermann?= Date: Fri, 31 Jul 2015 20:31:01 +0200 Subject: [PATCH 2/2] Applied .editorconfig Formatting to previously changed file --- .../DSL/Filter/HasChildFilterDescriptor.cs | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Nest/DSL/Filter/HasChildFilterDescriptor.cs b/src/Nest/DSL/Filter/HasChildFilterDescriptor.cs index cf932859b8a..c110a33b55d 100644 --- a/src/Nest/DSL/Filter/HasChildFilterDescriptor.cs +++ b/src/Nest/DSL/Filter/HasChildFilterDescriptor.cs @@ -13,13 +13,13 @@ public interface IHasChildFilter : IFilter [JsonProperty("type")] TypeNameMarker Type { get; set; } - [JsonProperty("min_children")] - int? MinChildren { get; set; } + [JsonProperty("min_children")] + int? MinChildren { get; set; } - [JsonProperty("max_children")] - int? MaxChildren { get; set; } + [JsonProperty("max_children")] + int? MaxChildren { get; set; } - [JsonProperty("query")] + [JsonProperty("query")] IQueryContainer Query { get; set; } [JsonProperty("filter")] @@ -31,7 +31,7 @@ public interface IHasChildFilter : IFilter IInnerHits InnerHits { get; set; } } - + public class HasChildFilter : PlainFilter, IHasChildFilter { protected internal override void WrapInContainer(IFilterContainer container) @@ -40,9 +40,9 @@ protected internal override void WrapInContainer(IFilterContainer container) } public TypeNameMarker Type { get; set; } - public int? MinChildren { get; set; } - public int? MaxChildren { get; set; } - public IQueryContainer Query { get; set; } + public int? MinChildren { get; set; } + public int? MaxChildren { get; set; } + public IQueryContainer Query { get; set; } public IFilterContainer Filter { get; set; } public IInnerHits InnerHits { get; set; } } @@ -65,11 +65,11 @@ bool IFilter.IsConditionless TypeNameMarker IHasChildFilter.Type { get; set; } - int? IHasChildFilter.MinChildren { get; set; } + int? IHasChildFilter.MinChildren { get; set; } - int? IHasChildFilter.MaxChildren { get; set; } + int? IHasChildFilter.MaxChildren { get; set; } - IQueryContainer IHasChildFilter.Query { get; set; } + IQueryContainer IHasChildFilter.Query { get; set; } IFilterContainer IHasChildFilter.Filter { get; set; } @@ -99,20 +99,20 @@ public HasChildFilterDescriptor Type(string type) Self.Type = type; return this; } - - public HasChildFilterDescriptor MinChildren(int minChildren) - { - Self.MinChildren = minChildren; - return this; - } - - public HasChildFilterDescriptor MaxChildren(int maxChildren) - { - Self.MaxChildren = maxChildren; - return this; - } - - public HasChildFilterDescriptor InnerHits() + + public HasChildFilterDescriptor MinChildren(int minChildren) + { + Self.MinChildren = minChildren; + return this; + } + + public HasChildFilterDescriptor MaxChildren(int maxChildren) + { + Self.MaxChildren = maxChildren; + return this; + } + + public HasChildFilterDescriptor InnerHits() { Self.InnerHits = new InnerHits(); return this;