diff --git a/src/Nest/DSL/Search/SortFieldDescriptor.cs b/src/Nest/DSL/Search/SortFieldDescriptor.cs index fa5167ee15d..4a7a7c89d56 100644 --- a/src/Nest/DSL/Search/SortFieldDescriptor.cs +++ b/src/Nest/DSL/Search/SortFieldDescriptor.cs @@ -125,6 +125,12 @@ public virtual SortFieldDescriptor Descending() return this; } + public virtual SortFieldDescriptor Order(SortOrder order) + { + Self.Order = order; + return this; + } + public virtual SortFieldDescriptor NestedMin() { Self.Mode = ScoreMode.Min; @@ -169,14 +175,5 @@ public SortFieldDescriptor NestedPath(Expression> objectPath) Self.NestedPath = objectPath; return this; } - - /// - /// Pass true to sort ascending false to sort descending - /// - public virtual SortFieldDescriptor ToggleSort(bool ascending) - { - Self.Order = ascending ? SortOrder.Descending : SortOrder.Ascending; - return this; - } } } diff --git a/src/Nest/DSL/Search/SortGeoDistanceDescriptor.cs b/src/Nest/DSL/Search/SortGeoDistanceDescriptor.cs index 982813169d0..0e7cad4682a 100644 --- a/src/Nest/DSL/Search/SortGeoDistanceDescriptor.cs +++ b/src/Nest/DSL/Search/SortGeoDistanceDescriptor.cs @@ -111,12 +111,10 @@ public SortGeoDistanceDescriptor Descending() Self.Order = SortOrder.Descending; return this; } - /// - /// Pass true to sort ascending false to sort descending - /// - public SortGeoDistanceDescriptor ToggleSort(bool ascending) + + public SortGeoDistanceDescriptor Order(SortOrder order) { - Self.Order = ascending ? SortOrder.Ascending : SortOrder.Descending; + Self.Order = order; return this; } diff --git a/src/Nest/DSL/Search/SortScriptDescriptor.cs b/src/Nest/DSL/Search/SortScriptDescriptor.cs index ab58f468c1c..9ff3121da41 100644 --- a/src/Nest/DSL/Search/SortScriptDescriptor.cs +++ b/src/Nest/DSL/Search/SortScriptDescriptor.cs @@ -93,12 +93,9 @@ public virtual SortScriptDescriptor Descending() return this; } - /// - /// Pass true to sort ascending false to sort descending - /// - public SortScriptDescriptor ToggleSort(bool ascending) + public SortScriptDescriptor Order(SortOrder order) { - Self.Order = ascending ? SortOrder.Ascending : SortOrder.Descending; + Self.Order = order; return this; } }