From cd28e480f3e5d5db8adc8567b253185307f39aed Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 25 Jun 2014 17:04:40 +0200 Subject: [PATCH 1/8] renamed a bunch of enums to follow c# conventions --- .../GeoDistanceAggregationDescriptor.cs | 10 ++-- src/Nest/DSL/Facets/DateInterval.cs | 22 ++++++-- src/Nest/DSL/Facets/DateRounding.cs | 12 +++-- src/Nest/DSL/Facets/EsRegexFlags.cs | 22 -------- src/Nest/DSL/Facets/TermFacetDescriptor.cs | 11 ++-- src/Nest/DSL/Facets/TermsOrder.cs | 22 ++++---- .../DSL/Filter/GeoDistanceFilterDescriptor.cs | 8 +-- .../GeoDistanceRangeFilterDescriptor.cs | 10 ++-- src/Nest/DSL/PutMappingDescriptor.cs | 2 +- .../Functions/FieldValueFactorModifier.cs | 28 ++++++++++ .../DSL/Query/Functions/FunctionBoostMode.cs | 20 ++++--- .../FunctionScoreFunctionsDescriptor.cs | 15 ------ .../DSL/Query/Functions/FunctionScoreMode.cs | 22 +++++--- .../DSL/Query/HasParentQueryDescriptor.cs | 2 +- src/Nest/Domain/DSL/ChildScoreType.cs | 13 +++-- src/Nest/Domain/DSL/ParentScoreType.cs | 7 ++- .../Attributes/ElasticPropertyAttribute.cs | 2 +- .../NestedObjectMappingDescriptor.cs | 2 +- .../Descriptors/ObjectMappingDescriptor.cs | 2 +- src/Nest/Enums/ClearCacheOptions.cs | 17 ------ src/Nest/Enums/ClusterStateInfo.cs | 14 ----- src/Nest/Enums/ComparatorType.cs | 14 ----- src/Nest/Enums/Consistency.cs | 14 ----- src/Nest/Enums/DateHistogramComparatorType.cs | 13 ----- src/Nest/Enums/DistanceUnit.cs | 13 ----- src/Nest/Enums/DynamicMappingOption.cs | 13 +++-- src/Nest/Enums/FieldIndexOption.cs | 13 +++-- src/Nest/Enums/FieldType.cs | 52 ++++++++++++------- src/Nest/Enums/GeoDistance.cs | 17 +++--- src/Nest/Enums/GeoDistanceType.cs | 13 ----- src/Nest/Enums/GeoExecution.cs | 7 ++- src/Nest/Enums/GeoHashPrecision.cs | 51 +++++++++--------- src/Nest/Enums/GeoOptimizeBBox.cs | 10 ++-- ...nt.cs => TermsAggregationExecutionHint.cs} | 10 ++-- src/Nest/Nest.csproj | 11 +--- .../DynamicMappingOptionConverter.cs | 10 ++-- .../Filters/GeoDistanceFilterConverter.cs | 2 +- .../GeoDistanceRangeFilterConverter.cs | 2 +- .../Resolvers/Writers/TypeMappingWriter.cs | 46 ++++++++-------- .../WritePropertiesFromAttributeVisitor.cs | 4 +- .../Queries/FunctionScoreQueryTests.cs | 4 +- .../Queries/HasChildQueryTests.cs | 4 +- .../Queries/HasParentQueryTests.cs | 4 +- .../Search/Facets/DateHistogramFacetJson.cs | 6 +-- .../Search/Facets/TermsFacetJson.cs | 4 +- .../Search/Query/Singles/HasChildQueryJson.cs | 2 +- .../Query/Singles/HasParentQueryJson.cs | 2 +- 47 files changed, 284 insertions(+), 320 deletions(-) delete mode 100644 src/Nest/DSL/Facets/EsRegexFlags.cs create mode 100644 src/Nest/DSL/Query/Functions/FieldValueFactorModifier.cs delete mode 100644 src/Nest/Enums/ClearCacheOptions.cs delete mode 100644 src/Nest/Enums/ClusterStateInfo.cs delete mode 100644 src/Nest/Enums/ComparatorType.cs delete mode 100644 src/Nest/Enums/Consistency.cs delete mode 100644 src/Nest/Enums/DateHistogramComparatorType.cs delete mode 100644 src/Nest/Enums/DistanceUnit.cs delete mode 100644 src/Nest/Enums/GeoDistanceType.cs rename src/Nest/Enums/{ExecutionHint.cs => TermsAggregationExecutionHint.cs} (72%) diff --git a/src/Nest/DSL/Aggregations/GeoDistanceAggregationDescriptor.cs b/src/Nest/DSL/Aggregations/GeoDistanceAggregationDescriptor.cs index b5b3d6e13bf..c3a5f9e8eae 100644 --- a/src/Nest/DSL/Aggregations/GeoDistanceAggregationDescriptor.cs +++ b/src/Nest/DSL/Aggregations/GeoDistanceAggregationDescriptor.cs @@ -24,7 +24,7 @@ public interface IGeoDistanceAggregator : IBucketAggregator GeoUnit? Unit { get; set; } [JsonProperty("distance_type")] - GeoDistanceType? DistanceType { get; set; } + GeoDistance? DistanceType { get; set; } [JsonProperty(PropertyName = "ranges")] IEnumerable> Ranges { get; set; } @@ -38,7 +38,7 @@ public class GeoDistanceAggregator : BucketAggregator, IGeoDistanceAggregator public GeoUnit? Unit { get; set; } - public GeoDistanceType? DistanceType { get; set; } + public GeoDistance? DistanceType { get; set; } public IEnumerable> Ranges { get; set; } } @@ -53,7 +53,7 @@ public class GeoDistanceAggregationDescriptor : BucketAggregationBaseDescript GeoUnit? IGeoDistanceAggregator.Unit { get; set; } - GeoDistanceType? IGeoDistanceAggregator.DistanceType { get; set; } + GeoDistance? IGeoDistanceAggregator.DistanceType { get; set; } IEnumerable> IGeoDistanceAggregator.Ranges { get; set; } @@ -88,9 +88,9 @@ public GeoDistanceAggregationDescriptor Unit(GeoUnit unit) return this; } - public GeoDistanceAggregationDescriptor DistanceType(GeoDistanceType geoDistanceType) + public GeoDistanceAggregationDescriptor DistanceType(GeoDistance geoDistance) { - Self.DistanceType = geoDistanceType; + Self.DistanceType = geoDistance; return this; } diff --git a/src/Nest/DSL/Facets/DateInterval.cs b/src/Nest/DSL/Facets/DateInterval.cs index 8f65853c6ca..6c196d61bfe 100644 --- a/src/Nest/DSL/Facets/DateInterval.cs +++ b/src/Nest/DSL/Facets/DateInterval.cs @@ -1,12 +1,26 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using System.Text; namespace Nest { - public enum DateInterval - { - Minute, Hour, Day, Week, Month, Quarter, Year - } + public enum DateInterval + { + [EnumMember(Value = "minute")] + Minute, + [EnumMember(Value = "hour")] + Hour, + [EnumMember(Value = "day")] + Day, + [EnumMember(Value = "week")] + Week, + [EnumMember(Value = "month")] + Month, + [EnumMember(Value = "quarter")] + Quarter, + [EnumMember(Value = "year")] + Year + } } diff --git a/src/Nest/DSL/Facets/DateRounding.cs b/src/Nest/DSL/Facets/DateRounding.cs index 92ead1e24e0..12a2f9bd01c 100644 --- a/src/Nest/DSL/Facets/DateRounding.cs +++ b/src/Nest/DSL/Facets/DateRounding.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using System.Text; namespace Nest @@ -10,22 +11,27 @@ public enum DateRounding /// /// (the default), rounds to the lowest whole unit of this field. /// + [EnumMember(Value = "minute")] Floor, /// /// Rounds to the highest whole unit of this field. /// + [EnumMember(Value = "ceiling")] Ceiling, /// /// Round to the nearest whole unit of this field. If the given millisecond value is closer to the floor or is exactly halfway, this function behaves like floor. If the millisecond value is closer to the ceiling, this function behaves like ceiling. /// - Half_Floor, + [EnumMember(Value = "half_floor")] + HalfFloor, /// /// Round to the nearest whole unit of this field. If the given millisecond value is closer to the floor, this function behaves like floor. If the millisecond value is closer to the ceiling or is exactly halfway, this function behaves like ceiling. /// - Half_Ceiling, + [EnumMember(Value = "half_ceiling")] + HalfCeiling, /// /// Round to the nearest whole unit of this field. If the given millisecond value is closer to the floor, this function behaves like floor. If the millisecond value is closer to the ceiling, this function behaves like ceiling. If the millisecond value is exactly halfway between the floor and ceiling, the ceiling is chosen over the floor only if it makes this field’s value even. /// - Half_Even + [EnumMember(Value = "half_even")] + HalfEven } } diff --git a/src/Nest/DSL/Facets/EsRegexFlags.cs b/src/Nest/DSL/Facets/EsRegexFlags.cs deleted file mode 100644 index 4828c36cfff..00000000000 --- a/src/Nest/DSL/Facets/EsRegexFlags.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using System.Linq.Expressions; - -namespace Nest -{ - public enum EsRegexFlags - { - CANNON_EQ, - CASE_INSENSITIVE, - COMMENTS, - DOTALL, - LITERAL, - MULTILINE, - UNICODE_CASE, - UNIX_LINES - } -} diff --git a/src/Nest/DSL/Facets/TermFacetDescriptor.cs b/src/Nest/DSL/Facets/TermFacetDescriptor.cs index ac6eefae813..26c551eb813 100644 --- a/src/Nest/DSL/Facets/TermFacetDescriptor.cs +++ b/src/Nest/DSL/Facets/TermFacetDescriptor.cs @@ -42,9 +42,8 @@ public interface ITermFacetRequest : IFacetRequest [JsonProperty(PropertyName = "regex")] string Regex { get; set; } - [JsonConverter(typeof (StringEnumConverter))] [JsonProperty(PropertyName = "regex_flags")] - EsRegexFlags? RegexFlags { get; set; } + string RegexFlags { get; set; } [JsonProperty(PropertyName = "script")] string Script { get; set; } @@ -64,7 +63,7 @@ public class TermFacetRequest : FacetRequest, ITermFacetRequest public IEnumerable Exclude { get; set; } public string ExecutionHint { get; set; } public string Regex { get; set; } - public EsRegexFlags? RegexFlags { get; set; } + public string RegexFlags { get; set; } public string Script { get; set; } public string ScriptField { get; set; } } @@ -92,7 +91,7 @@ public class TermFacetDescriptor : BaseFacetDescriptor string ITermFacetRequest.Regex { get; set; } - EsRegexFlags? ITermFacetRequest.RegexFlags { get; set; } + string ITermFacetRequest.RegexFlags { get; set; } string ITermFacetRequest.Script { get; set; } @@ -147,10 +146,10 @@ public TermFacetDescriptor AllTerms() Self.AllTerms = true; return this; } - public TermFacetDescriptor Regex(string regex, EsRegexFlags? Flags = null) + public TermFacetDescriptor Regex(string regex, string flags = null) { Self.Regex = regex; - Self.RegexFlags = Flags; + Self.RegexFlags = flags; return this; } diff --git a/src/Nest/DSL/Facets/TermsOrder.cs b/src/Nest/DSL/Facets/TermsOrder.cs index 38b9e480a61..53bdf04daff 100644 --- a/src/Nest/DSL/Facets/TermsOrder.cs +++ b/src/Nest/DSL/Facets/TermsOrder.cs @@ -1,18 +1,20 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using System.Text; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using System.Linq.Expressions; namespace Nest { - public enum TermsOrder - { - count = 0, - term, - reverse_count, - reverse_term - } + public enum TermsOrder + { + [EnumMember(Value = "count")] + Count = 0, + [EnumMember(Value = "term")] + Term, + [EnumMember(Value = "reverse_count")] + ReverseCount, + [EnumMember(Value = "reverse_term")] + ReverseTerm + } } diff --git a/src/Nest/DSL/Filter/GeoDistanceFilterDescriptor.cs b/src/Nest/DSL/Filter/GeoDistanceFilterDescriptor.cs index 92e25de1c82..2cb15a9bc20 100644 --- a/src/Nest/DSL/Filter/GeoDistanceFilterDescriptor.cs +++ b/src/Nest/DSL/Filter/GeoDistanceFilterDescriptor.cs @@ -32,7 +32,7 @@ public interface IGeoDistanceFilter : IFilter [JsonProperty("distance_type")] [JsonConverter(typeof(StringEnumConverter))] - GeoDistanceType? DistanceType { get; set; } + GeoDistance? DistanceType { get; set; } } public class GeoDistanceFilter : PlainFilter, IGeoDistanceFilter @@ -47,7 +47,7 @@ protected internal override void WrapInContainer(IFilterContainer container) public object Distance { get; set; } public GeoUnit? Unit { get; set; } public GeoOptimizeBBox? OptimizeBoundingBox { get; set; } - public GeoDistanceType? DistanceType { get; set; } + public GeoDistance? DistanceType { get; set; } } public class GeoDistanceFilterDescriptor : FilterBase, IGeoDistanceFilter @@ -56,7 +56,7 @@ public class GeoDistanceFilterDescriptor : FilterBase, IGeoDistanceFilter string IGeoDistanceFilter.Location { get; set; } object IGeoDistanceFilter.Distance { get; set; } GeoUnit? IGeoDistanceFilter.Unit { get; set; } - GeoDistanceType? IGeoDistanceFilter.DistanceType { get; set; } + GeoDistance? IGeoDistanceFilter.DistanceType { get; set; } GeoOptimizeBBox? IGeoDistanceFilter.OptimizeBoundingBox { get; set; } bool IFilter.IsConditionless @@ -94,7 +94,7 @@ public GeoDistanceFilterDescriptor Optimize(GeoOptimizeBBox optimize) ((IGeoDistanceFilter)this).OptimizeBoundingBox = optimize; return this; } - public GeoDistanceFilterDescriptor DistanceType(GeoDistanceType type) + public GeoDistanceFilterDescriptor DistanceType(GeoDistance type) { ((IGeoDistanceFilter)this).DistanceType = type; return this; diff --git a/src/Nest/DSL/Filter/GeoDistanceRangeFilterDescriptor.cs b/src/Nest/DSL/Filter/GeoDistanceRangeFilterDescriptor.cs index b75b99eb453..89e28eabd26 100644 --- a/src/Nest/DSL/Filter/GeoDistanceRangeFilterDescriptor.cs +++ b/src/Nest/DSL/Filter/GeoDistanceRangeFilterDescriptor.cs @@ -27,7 +27,7 @@ public interface IGeoDistanceRangeFilter : IFilter GeoUnit? Unit { get; set; } [JsonProperty("distance_type")] - GeoDistanceType? DistanceType { get; set; } + GeoDistance? DistanceType { get; set; } [JsonProperty("optimize_bbox")] GeoOptimizeBBox? OptimizeBoundingBox { get; set; } @@ -51,7 +51,7 @@ protected internal override void WrapInContainer(IFilterContainer container) public object From { get; set; } public object To { get; set; } public GeoUnit? Unit { get; set; } - public GeoDistanceType? DistanceType { get; set; } + public GeoDistance? DistanceType { get; set; } public GeoOptimizeBBox? OptimizeBoundingBox { get; set; } public bool? IncludeLower { get; set; } public bool? IncludeUpper { get; set; } @@ -65,7 +65,7 @@ public class GeoDistanceRangeFilterDescriptor : FilterBase, IGeoDistanceRangeFil object IGeoDistanceRangeFilter.To { get; set; } bool? IGeoDistanceRangeFilter.IncludeLower { get; set; } bool? IGeoDistanceRangeFilter.IncludeUpper { get; set; } - GeoDistanceType? IGeoDistanceRangeFilter.DistanceType { get; set; } + GeoDistance? IGeoDistanceRangeFilter.DistanceType { get; set; } GeoOptimizeBBox? IGeoDistanceRangeFilter.OptimizeBoundingBox { get; set; } GeoUnit? IGeoDistanceRangeFilter.Unit { get; set; } @@ -116,9 +116,9 @@ public GeoDistanceRangeFilterDescriptor Optimize(GeoOptimizeBBox optimize) return this; } - public GeoDistanceRangeFilterDescriptor DistanceType(GeoDistanceType geoDistanceType) + public GeoDistanceRangeFilterDescriptor DistanceType(GeoDistance geoDistance) { - _.DistanceType = geoDistanceType; + _.DistanceType = geoDistance; return this; } diff --git a/src/Nest/DSL/PutMappingDescriptor.cs b/src/Nest/DSL/PutMappingDescriptor.cs index 78ecff04ee1..34bcfdff8e6 100644 --- a/src/Nest/DSL/PutMappingDescriptor.cs +++ b/src/Nest/DSL/PutMappingDescriptor.cs @@ -63,7 +63,7 @@ public PutMappingDescriptor Dynamic(DynamicMappingOption dynamic) } public PutMappingDescriptor Dynamic(bool dynamic = true) { - return this.Dynamic(dynamic ? DynamicMappingOption.allow : DynamicMappingOption.ignore); + return this.Dynamic(dynamic ? DynamicMappingOption.Allow : DynamicMappingOption.Ignore); } public PutMappingDescriptor Enabled(bool enabled = true) { diff --git a/src/Nest/DSL/Query/Functions/FieldValueFactorModifier.cs b/src/Nest/DSL/Query/Functions/FieldValueFactorModifier.cs new file mode 100644 index 00000000000..002bc56e8cb --- /dev/null +++ b/src/Nest/DSL/Query/Functions/FieldValueFactorModifier.cs @@ -0,0 +1,28 @@ +using System.Runtime.Serialization; + +namespace Nest +{ + public enum FieldValueFactorModifier + { + [EnumMember(Value = "none")] + None, + [EnumMember(Value = "count")] + Log, + [EnumMember(Value = "log1p")] + Log1P, + [EnumMember(Value = "log2p")] + Log2P, + [EnumMember(Value = "ln")] + Ln, + [EnumMember(Value = "ln1p")] + Ln1P, + [EnumMember(Value = "ln2p")] + Ln2P, + [EnumMember(Value = "square")] + Square, + [EnumMember(Value = "sqrt")] + SquareRoot, + [EnumMember(Value = "reciprocal")] + Reciprocal + } +} \ No newline at end of file diff --git a/src/Nest/DSL/Query/Functions/FunctionBoostMode.cs b/src/Nest/DSL/Query/Functions/FunctionBoostMode.cs index fa34e8198b1..3802548a903 100644 --- a/src/Nest/DSL/Query/Functions/FunctionBoostMode.cs +++ b/src/Nest/DSL/Query/Functions/FunctionBoostMode.cs @@ -1,12 +1,20 @@ +using System.Runtime.Serialization; + namespace Nest { public enum FunctionBoostMode { - multiply, - replace, - sum, - avg, - max, - min + [EnumMember(Value = "multiply")] + Multiply, + [EnumMember(Value = "replace")] + Replace, + [EnumMember(Value = "sum")] + Sum, + [EnumMember(Value = "avg")] + Average, + [EnumMember(Value = "max")] + Max, + [EnumMember(Value = "min")] + Min } } \ No newline at end of file diff --git a/src/Nest/DSL/Query/Functions/FunctionScoreFunctionsDescriptor.cs b/src/Nest/DSL/Query/Functions/FunctionScoreFunctionsDescriptor.cs index 6fa39474db0..437b1e335fb 100644 --- a/src/Nest/DSL/Query/Functions/FunctionScoreFunctionsDescriptor.cs +++ b/src/Nest/DSL/Query/Functions/FunctionScoreFunctionsDescriptor.cs @@ -117,19 +117,4 @@ public FieldValueFactor(Action> descriptorBuilder) this._FieldValueFactor = descriptor; } } - - public enum FieldValueFactorModifier - { - none, - log, - log1p, - log2p, - ln, - ln1p, - ln2p, - square, - sqrt, - reciprocal - } - } \ No newline at end of file diff --git a/src/Nest/DSL/Query/Functions/FunctionScoreMode.cs b/src/Nest/DSL/Query/Functions/FunctionScoreMode.cs index d7e2e233226..e2e907bc284 100644 --- a/src/Nest/DSL/Query/Functions/FunctionScoreMode.cs +++ b/src/Nest/DSL/Query/Functions/FunctionScoreMode.cs @@ -1,12 +1,20 @@ -namespace Nest +using System.Runtime.Serialization; + +namespace Nest { public enum FunctionScoreMode { - multiply, - sum, - avg, - first, - max, - min + [EnumMember(Value = "multiply")] + Multiply, + [EnumMember(Value = "sum")] + Sum, + [EnumMember(Value = "avg")] + Average, + [EnumMember(Value = "first")] + First, + [EnumMember(Value = "max")] + Max, + [EnumMember(Value = "min")] + Min } } \ No newline at end of file diff --git a/src/Nest/DSL/Query/HasParentQueryDescriptor.cs b/src/Nest/DSL/Query/HasParentQueryDescriptor.cs index 693ccf172d1..fb01f11726a 100644 --- a/src/Nest/DSL/Query/HasParentQueryDescriptor.cs +++ b/src/Nest/DSL/Query/HasParentQueryDescriptor.cs @@ -85,7 +85,7 @@ public HasParentQueryDescriptor Type(string type) return this; } - public HasParentQueryDescriptor Score(ParentScoreType? scoreType = ParentScoreType.score) + public HasParentQueryDescriptor Score(ParentScoreType? scoreType = ParentScoreType.Score) { ((IHasParentQuery)this).ScoreType = scoreType; return this; diff --git a/src/Nest/Domain/DSL/ChildScoreType.cs b/src/Nest/Domain/DSL/ChildScoreType.cs index ee69931a3df..4c6b8de92ea 100644 --- a/src/Nest/Domain/DSL/ChildScoreType.cs +++ b/src/Nest/Domain/DSL/ChildScoreType.cs @@ -1,15 +1,20 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using System.Text; namespace Nest { public enum ChildScoreType { - none, - avg, - sum, - max + [EnumMember(Value = "none")] + None, + [EnumMember(Value = "avg")] + Average, + [EnumMember(Value = "sum")] + Sum, + [EnumMember(Value = "max")] + Max } } diff --git a/src/Nest/Domain/DSL/ParentScoreType.cs b/src/Nest/Domain/DSL/ParentScoreType.cs index 84386a3403f..c11a3e61205 100644 --- a/src/Nest/Domain/DSL/ParentScoreType.cs +++ b/src/Nest/Domain/DSL/ParentScoreType.cs @@ -1,13 +1,16 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using System.Text; namespace Nest { public enum ParentScoreType { - none = 0, - score + [EnumMember(Value = "none")] + None = 0, + [EnumMember(Value = "score")] + Score } } diff --git a/src/Nest/Domain/Mapping/Attributes/ElasticPropertyAttribute.cs b/src/Nest/Domain/Mapping/Attributes/ElasticPropertyAttribute.cs index 71cee70eb57..81328bd2b11 100644 --- a/src/Nest/Domain/Mapping/Attributes/ElasticPropertyAttribute.cs +++ b/src/Nest/Domain/Mapping/Attributes/ElasticPropertyAttribute.cs @@ -48,7 +48,7 @@ public ElasticPropertyAttribute() //make sure we match ES's defaults this.Boost = 1; this.TermVector = TermVectorOption.no; - this.Index = FieldIndexOption.analyzed; + this.Index = FieldIndexOption.Analyzed; this.IncludeInAll = true; this.PrecisionStep = 4; diff --git a/src/Nest/Domain/Mapping/Descriptors/NestedObjectMappingDescriptor.cs b/src/Nest/Domain/Mapping/Descriptors/NestedObjectMappingDescriptor.cs index 17a4b9306fa..b1302a80723 100644 --- a/src/Nest/Domain/Mapping/Descriptors/NestedObjectMappingDescriptor.cs +++ b/src/Nest/Domain/Mapping/Descriptors/NestedObjectMappingDescriptor.cs @@ -69,7 +69,7 @@ public NestedObjectMappingDescriptor Dynamic(DynamicMappingOpti } public NestedObjectMappingDescriptor Dynamic(bool dynamic = true) { - return this.Dynamic(dynamic ? DynamicMappingOption.allow : DynamicMappingOption.ignore); + return this.Dynamic(dynamic ? DynamicMappingOption.Allow : DynamicMappingOption.Ignore); } public NestedObjectMappingDescriptor Enabled(bool enabled = true) { diff --git a/src/Nest/Domain/Mapping/Descriptors/ObjectMappingDescriptor.cs b/src/Nest/Domain/Mapping/Descriptors/ObjectMappingDescriptor.cs index 8b3f58d9fd2..598ae5dea31 100644 --- a/src/Nest/Domain/Mapping/Descriptors/ObjectMappingDescriptor.cs +++ b/src/Nest/Domain/Mapping/Descriptors/ObjectMappingDescriptor.cs @@ -67,7 +67,7 @@ public ObjectMappingDescriptor Dynamic(DynamicMappingOption dyn } public ObjectMappingDescriptor Dynamic(bool dynamic = true) { - return this.Dynamic(dynamic ? DynamicMappingOption.allow : DynamicMappingOption.ignore); + return this.Dynamic(dynamic ? DynamicMappingOption.Allow : DynamicMappingOption.Ignore); } public ObjectMappingDescriptor Enabled(bool enabled = true) { diff --git a/src/Nest/Enums/ClearCacheOptions.cs b/src/Nest/Enums/ClearCacheOptions.cs deleted file mode 100644 index 3601f398110..00000000000 --- a/src/Nest/Enums/ClearCacheOptions.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Nest -{ - [Flags] - public enum ClearCacheOptions - { - Id = 0x1, - Filter = 0x2, - FieldData = 0x4, - Bloom = 0x8, - All = Id | Filter | FieldData | Bloom - } -} diff --git a/src/Nest/Enums/ClusterStateInfo.cs b/src/Nest/Enums/ClusterStateInfo.cs deleted file mode 100644 index 2affdec576e..00000000000 --- a/src/Nest/Enums/ClusterStateInfo.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace Nest -{ - [Flags] - public enum ClusterStateInfo - { - All = 0, - ExcludeNodes = 1 << 1, - ExcludeRoutingTable = 1 << 2, - ExcludeMetadata = 1 << 3, - ExcludeBlocks = 1 << 4 - } -} diff --git a/src/Nest/Enums/ComparatorType.cs b/src/Nest/Enums/ComparatorType.cs deleted file mode 100644 index 6cd39d0f64b..00000000000 --- a/src/Nest/Enums/ComparatorType.cs +++ /dev/null @@ -1,14 +0,0 @@ -// ReSharper disable InconsistentNaming -// ReSharper disable CheckNamespace -namespace Nest -{ - public enum ComparatorType - { - COUNT, - REVERSE_COUNT, - TERM, - REVERSE_TERM - } -} -// ReSharper restore CheckNamespace -// ReSharper restore InconsistentNaming \ No newline at end of file diff --git a/src/Nest/Enums/Consistency.cs b/src/Nest/Enums/Consistency.cs deleted file mode 100644 index c1c261bd5a2..00000000000 --- a/src/Nest/Enums/Consistency.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Nest -{ - public enum Consistency - { - Quorum, //default in ES - One, - All - } -} diff --git a/src/Nest/Enums/DateHistogramComparatorType.cs b/src/Nest/Enums/DateHistogramComparatorType.cs deleted file mode 100644 index e85b2bd11c8..00000000000 --- a/src/Nest/Enums/DateHistogramComparatorType.cs +++ /dev/null @@ -1,13 +0,0 @@ -// ReSharper disable InconsistentNaming -// ReSharper disable CheckNamespace -namespace Nest -{ - public enum DateHistogramComparatorType - { - TIME, - COUNT, - TOTAL - } -} -// ReSharper restore CheckNamespace -// ReSharper restore InconsistentNaming \ No newline at end of file diff --git a/src/Nest/Enums/DistanceUnit.cs b/src/Nest/Enums/DistanceUnit.cs deleted file mode 100644 index a9665e28ee3..00000000000 --- a/src/Nest/Enums/DistanceUnit.cs +++ /dev/null @@ -1,13 +0,0 @@ -// ReSharper disable InconsistentNaming -// ReSharper disable CheckNamespace -namespace Nest -{ - public enum DistanceUnit - { - - MILES, - KILOMETERS - } -} -// ReSharper restore CheckNamespace -// ReSharper restore InconsistentNaming \ No newline at end of file diff --git a/src/Nest/Enums/DynamicMappingOption.cs b/src/Nest/Enums/DynamicMappingOption.cs index 7145e4c2de8..8ce2dc78a09 100644 --- a/src/Nest/Enums/DynamicMappingOption.cs +++ b/src/Nest/Enums/DynamicMappingOption.cs @@ -1,4 +1,6 @@ -namespace Nest +using System.Runtime.Serialization; + +namespace Nest { /// /// Controls how elasticsearch handles dynamic mapping changes when a new document present new fields @@ -8,14 +10,17 @@ public enum DynamicMappingOption /// /// Default value, allows unmapped fields to be cause a mapping update /// - allow, + [EnumMember(Value = "allow")] + Allow, /// /// New unmapped fields will be silently ignored /// - ignore, + [EnumMember(Value = "ignore")] + Ignore, /// /// If new unmapped fields are passed, the whole document WON'T be added/updated /// - strict + [EnumMember(Value = "strict")] + Strict } } diff --git a/src/Nest/Enums/FieldIndexOption.cs b/src/Nest/Enums/FieldIndexOption.cs index 61f84f940bb..921c19c64c4 100644 --- a/src/Nest/Enums/FieldIndexOption.cs +++ b/src/Nest/Enums/FieldIndexOption.cs @@ -1,9 +1,14 @@ -namespace Nest +using System.Runtime.Serialization; + +namespace Nest { public enum FieldIndexOption { - analyzed, - not_analyzed, - no + [EnumMember(Value = "analyzed")] + Analyzed, + [EnumMember(Value = "not_analyzed")] + NotAnalyzed, + [EnumMember(Value = "no")] + No } } diff --git a/src/Nest/Enums/FieldType.cs b/src/Nest/Enums/FieldType.cs index 86856a9b013..fc80b9b52fc 100644 --- a/src/Nest/Enums/FieldType.cs +++ b/src/Nest/Enums/FieldType.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using System.Text; namespace Nest @@ -13,63 +14,78 @@ public enum FieldType /// /// Default. Will be defined by the type of property return. /// - none, + [EnumMember(Value = "none")] + None, /// /// Geo based points. /// - geo_point, + [EnumMember(Value = "geo_point")] + GeoPoint, /// /// The attachment type allows to index different “attachment” type field (encoded as base64), for example, microsoft office formats, open document formats, ePub, HTML... /// - attachment, + [EnumMember(Value = "attachment")] + Attachment, /// /// An ip mapping type allows to store ipv4 addresses in a numeric form allowing to easily sort, and range query it (using ip values). /// - ip, + [EnumMember(Value = "ip")] + Ip, /// /// The binary type is a base64 representation of binary data that can be stored in the index. /// - binary, + [EnumMember(Value = "binary")] + Binary, /// /// Text based string type. /// - string_type, + [EnumMember(Value = "string")] + String, /// /// Integer type. /// - integer_type, + [EnumMember(Value = "integer")] + Integer, /// /// Long type. /// - long_type, + [EnumMember(Value = "long")] + Long, /// /// Float type. /// - float_type, + [EnumMember(Value = "float")] + Float, /// /// Double type. /// - double_type, + [EnumMember(Value = "double")] + Double, /// /// Date type. /// - date_type, + [EnumMember(Value = "date")] + Date, /// /// Boolean type. /// - boolean_type, + [EnumMember(Value = "boolean")] + Boolean, /// /// Completion type. /// - completion, - /// - /// Nested type. - /// - nested, + [EnumMember(Value = "completion")] + Completion, + /// + /// Nested type. + /// + [EnumMember(Value = "nested")] + Nested, /// /// object type, no need to set this manually if its not a value type this will be set. /// Only set this if you need to force a value type to be mapped to an elasticsearch object type. /// - @object + [EnumMember(Value = "object")] + Object } } diff --git a/src/Nest/Enums/GeoDistance.cs b/src/Nest/Enums/GeoDistance.cs index b18ab229728..119440c92dc 100644 --- a/src/Nest/Enums/GeoDistance.cs +++ b/src/Nest/Enums/GeoDistance.cs @@ -1,18 +1,17 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; -using System.Linq.Expressions; namespace Nest { [JsonConverter(typeof(StringEnumConverter))] public enum GeoDistance { - arc, - plane, - factor + [EnumMember(Value = "sloppy_arc")] + SloppyArc, + [EnumMember(Value = "arc")] + Arc, + [EnumMember(Value = "plane")] + Plane } -} +} \ No newline at end of file diff --git a/src/Nest/Enums/GeoDistanceType.cs b/src/Nest/Enums/GeoDistanceType.cs deleted file mode 100644 index 4caadcc5515..00000000000 --- a/src/Nest/Enums/GeoDistanceType.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace Nest -{ - [JsonConverter(typeof(StringEnumConverter))] - public enum GeoDistanceType - { - sloppy_arc, - arc, - plane - } -} \ No newline at end of file diff --git a/src/Nest/Enums/GeoExecution.cs b/src/Nest/Enums/GeoExecution.cs index ae716c9f63e..bf8d9039432 100644 --- a/src/Nest/Enums/GeoExecution.cs +++ b/src/Nest/Enums/GeoExecution.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using System.Text; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -11,7 +12,9 @@ namespace Nest [JsonConverter(typeof(StringEnumConverter))] public enum GeoExecution { - memory, - indexed + [EnumMember(Value = "memory")] + Memory, + [EnumMember(Value = "indexed")] + Indexed } } diff --git a/src/Nest/Enums/GeoHashPrecision.cs b/src/Nest/Enums/GeoHashPrecision.cs index 2fd9b5d9c16..da4179757bb 100644 --- a/src/Nest/Enums/GeoHashPrecision.cs +++ b/src/Nest/Enums/GeoHashPrecision.cs @@ -2,9 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using System.Linq.Expressions; namespace Nest { @@ -13,61 +10,61 @@ public enum GeoHashPrecision /// /// 5,009.4km x 4,992.6km /// - precision_1 = 1, - + Precision1 = 1, + /// /// 1,252.3km x 624.1km /// - precision_2 = 2, - + Precision2 = 2, + /// /// 156.5km x 156km /// - precision_3 = 3, - + Precision3 = 3, + /// /// 39.1km x 19.5km /// - precision_4 = 4, - + Precision4 = 4, + /// /// 4.9km x 4.9km /// - precision_5 = 5, - + Precision5 = 5, + /// /// 1.2km x 609.4m /// - precision_6 = 6, - + Precision6 = 6, + /// /// 152.9m x 152.4m /// - precision_7 = 7, - + Precision7 = 7, + /// // 38.2m x 19m /// - precision_8 = 8, - + Precision8 = 8, + /// /// 4.8m x 4.8m /// - precision_9 = 9, - + Precision9 = 9, + /// // 1.2m x 59.5cm /// - precision_10 = 10, - + Precision10 = 10, + /// /// 14.9cm x 14.9cm /// - precision_11 = 11, - + Precision11 = 11, + /// // 3.7cm x 1.9cm /// - precision_12 = 12 -} + Precision12 = 12 + } } diff --git a/src/Nest/Enums/GeoOptimizeBBox.cs b/src/Nest/Enums/GeoOptimizeBBox.cs index 28ae975ec97..93f8a63eabe 100644 --- a/src/Nest/Enums/GeoOptimizeBBox.cs +++ b/src/Nest/Enums/GeoOptimizeBBox.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using System.Text; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -11,8 +12,11 @@ namespace Nest [JsonConverter(typeof(StringEnumConverter))] public enum GeoOptimizeBBox { - memory, - indexed, - none + [EnumMember(Value = "memory")] + Memory, + [EnumMember(Value = "indexed")] + Indexed, + [EnumMember(Value = "none")] + None } } diff --git a/src/Nest/Enums/ExecutionHint.cs b/src/Nest/Enums/TermsAggregationExecutionHint.cs similarity index 72% rename from src/Nest/Enums/ExecutionHint.cs rename to src/Nest/Enums/TermsAggregationExecutionHint.cs index 11874128563..672702df3df 100644 --- a/src/Nest/Enums/ExecutionHint.cs +++ b/src/Nest/Enums/TermsAggregationExecutionHint.cs @@ -1,4 +1,6 @@ -namespace Nest +using System.Runtime.Serialization; + +namespace Nest { /// /// Determines how the terms aggregation is executed @@ -8,10 +10,12 @@ public enum TermsAggregationExecutionHint /// /// Order by using field values directly in order to aggregate data per-bucket /// - map, + [EnumMember(Value = "map")] + Map, /// /// Order by using ordinals of the field values instead of the values themselves /// - ordinals + [EnumMember(Value = "ordinals")] + Ordinals } } \ No newline at end of file diff --git a/src/Nest/Nest.csproj b/src/Nest/Nest.csproj index 199350f948c..71c4643c1c5 100644 --- a/src/Nest/Nest.csproj +++ b/src/Nest/Nest.csproj @@ -164,6 +164,7 @@ + @@ -326,7 +327,7 @@ - + @@ -393,7 +394,6 @@ - @@ -602,7 +602,6 @@ - @@ -616,8 +615,6 @@ - - @@ -627,7 +624,6 @@ - @@ -641,7 +637,6 @@ - @@ -755,7 +750,6 @@ - @@ -815,7 +809,6 @@ - diff --git a/src/Nest/Resolvers/Converters/DynamicMappingOptionConverter.cs b/src/Nest/Resolvers/Converters/DynamicMappingOptionConverter.cs index b6e68b4eedc..aa506fe72fd 100644 --- a/src/Nest/Resolvers/Converters/DynamicMappingOptionConverter.cs +++ b/src/Nest/Resolvers/Converters/DynamicMappingOptionConverter.cs @@ -18,10 +18,10 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s } switch (v.Value) { - case DynamicMappingOption.strict: + case DynamicMappingOption.Strict: writer.WriteValue("strict"); break; - case DynamicMappingOption.ignore: + case DynamicMappingOption.Ignore: writer.WriteValue(false); break; default: @@ -40,11 +40,11 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist switch (sv) { case "false": - return DynamicMappingOption.ignore; + return DynamicMappingOption.Ignore; case "strict": - return DynamicMappingOption.strict; + return DynamicMappingOption.Strict; default: - return DynamicMappingOption.allow; + return DynamicMappingOption.Allow; } } diff --git a/src/Nest/Resolvers/Converters/Filters/GeoDistanceFilterConverter.cs b/src/Nest/Resolvers/Converters/Filters/GeoDistanceFilterConverter.cs index 30899497e43..c1398f630f1 100644 --- a/src/Nest/Resolvers/Converters/Filters/GeoDistanceFilterConverter.cs +++ b/src/Nest/Resolvers/Converters/Filters/GeoDistanceFilterConverter.cs @@ -75,7 +75,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist filter.Distance = jv.Value.Value(); break; case "distance_type": - filter.DistanceType = Enum.Parse(typeof(GeoDistanceType), jv.Value.Value()) as GeoDistanceType?; + filter.DistanceType = Enum.Parse(typeof(GeoDistance), jv.Value.Value()) as GeoDistance?; break; case "optimize_bbox": filter.OptimizeBoundingBox = Enum.Parse(typeof(GeoOptimizeBBox), jv.Value.Value()) as GeoOptimizeBBox?; diff --git a/src/Nest/Resolvers/Converters/Filters/GeoDistanceRangeFilterConverter.cs b/src/Nest/Resolvers/Converters/Filters/GeoDistanceRangeFilterConverter.cs index ac4e9320741..1ad7243645f 100644 --- a/src/Nest/Resolvers/Converters/Filters/GeoDistanceRangeFilterConverter.cs +++ b/src/Nest/Resolvers/Converters/Filters/GeoDistanceRangeFilterConverter.cs @@ -87,7 +87,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist filter.To = jv.Value.Value(); break; case "distance_type": - filter.DistanceType = Enum.Parse(typeof(GeoDistanceType), jv.Value.Value()) as GeoDistanceType?; + filter.DistanceType = Enum.Parse(typeof(GeoDistance), jv.Value.Value()) as GeoDistance?; break; case "optimize_bbox": filter.OptimizeBoundingBox = Enum.Parse(typeof(GeoOptimizeBBox), jv.Value.Value()) as GeoOptimizeBBox?; diff --git a/src/Nest/Resolvers/Writers/TypeMappingWriter.cs b/src/Nest/Resolvers/Writers/TypeMappingWriter.cs index 079e190debb..6ae506cecc7 100644 --- a/src/Nest/Resolvers/Writers/TypeMappingWriter.cs +++ b/src/Nest/Resolvers/Writers/TypeMappingWriter.cs @@ -192,7 +192,7 @@ private string GetElasticSearchType(IElasticPropertyAttribute att, PropertyInfo fieldType = att.Type; } - if (fieldType == null || fieldType == FieldType.none) + if (fieldType == null || fieldType == FieldType.None) { fieldType = this.GetFieldTypeFromType(p.PropertyType); } @@ -209,33 +209,33 @@ private string GetElasticSearchTypeFromFieldType(FieldType? fieldType) { switch (fieldType) { - case FieldType.geo_point: + case FieldType.GeoPoint: return "geo_point"; - case FieldType.attachment: + case FieldType.Attachment: return "attachment"; - case FieldType.ip: + case FieldType.Ip: return "ip"; - case FieldType.binary: + case FieldType.Binary: return "binary"; - case FieldType.string_type: + case FieldType.String: return "string"; - case FieldType.integer_type: + case FieldType.Integer: return "integer"; - case FieldType.long_type: + case FieldType.Long: return "long"; - case FieldType.float_type: + case FieldType.Float: return "float"; - case FieldType.double_type: + case FieldType.Double: return "double"; - case FieldType.date_type: + case FieldType.Date: return "date"; - case FieldType.boolean_type: + case FieldType.Boolean: return "boolean"; - case FieldType.completion: + case FieldType.Completion: return "completion"; - case FieldType.nested: + case FieldType.Nested: return "nested"; - case FieldType.@object: + case FieldType.Object: return "object"; default: return null; @@ -252,29 +252,29 @@ private string GetElasticSearchTypeFromFieldType(FieldType? fieldType) propertyType = GetUnderlyingType(propertyType); if (propertyType == typeof(string)) - return FieldType.string_type; + return FieldType.String; if (propertyType.IsValueType) { switch (propertyType.Name) { case "Int32": - return FieldType.integer_type; + return FieldType.Integer; case "Int64": - return FieldType.long_type; + return FieldType.Long; case "Single": - return FieldType.float_type; + return FieldType.Float; case "Decimal": case "Double": - return FieldType.double_type; + return FieldType.Double; case "DateTime": - return FieldType.date_type; + return FieldType.Date; case "Boolean": - return FieldType.boolean_type; + return FieldType.Boolean; } } else - return FieldType.@object; + return FieldType.Object; return null; } diff --git a/src/Nest/Resolvers/Writers/WritePropertiesFromAttributeVisitor.cs b/src/Nest/Resolvers/Writers/WritePropertiesFromAttributeVisitor.cs index 188938ec558..a38e2231543 100644 --- a/src/Nest/Resolvers/Writers/WritePropertiesFromAttributeVisitor.cs +++ b/src/Nest/Resolvers/Writers/WritePropertiesFromAttributeVisitor.cs @@ -73,7 +73,7 @@ public void VisitBaseAttribute(IElasticPropertyAttribute att) { this._jsonWriter.WritePropertyName("format"); this._jsonWriter.WriteValue(att.DateFormat); } - if (att.Index != FieldIndexOption.analyzed) + if (att.Index != FieldIndexOption.Analyzed) { this._jsonWriter.WritePropertyName("index"); this._jsonWriter.WriteValue(Enum.GetName(typeof (FieldIndexOption), att.Index)); @@ -144,7 +144,7 @@ public void VisitBaseAttribute(IElasticPropertyAttribute att) { if (att.SortAnalyzer.IsNullOrEmpty()) { this._jsonWriter.WritePropertyName("index"); - this._jsonWriter.WriteValue(Enum.GetName(typeof(FieldIndexOption), FieldIndexOption.not_analyzed)); + this._jsonWriter.WriteValue(Enum.GetName(typeof(FieldIndexOption), FieldIndexOption.NotAnalyzed)); } else { diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/FunctionScoreQueryTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/FunctionScoreQueryTests.cs index 1425a0121a9..462ade125b1 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/FunctionScoreQueryTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/FunctionScoreQueryTests.cs @@ -14,7 +14,7 @@ public void FunctionScore_Deserializes() var q = this.SerializeThenDeserialize( f=>f.FunctionScore, f=>f.FunctionScore(fq=>fq - .BoostMode(FunctionBoostMode.avg) + .BoostMode(FunctionBoostMode.Average) .Functions( ff => ff.Gauss(x => x.StartedOn, d => d.Scale("42w")), ff => ff.Linear(x => x.FloatValue, d => d.Scale("0.3")), @@ -32,7 +32,7 @@ public void FunctionScore_Deserializes() ) ); - q.BoostMode.Should().Be(FunctionBoostMode.avg); + q.BoostMode.Should().Be(FunctionBoostMode.Average); q.RandomScore.Should().NotBeNull(); q.RandomScore.Seed.Should().Be(1337); q.ScoreMode.Should().Be(FunctionScoreMode.first); diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/HasChildQueryTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/HasChildQueryTests.cs index 27f917d771c..e4e484af7d8 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/HasChildQueryTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/HasChildQueryTests.cs @@ -16,12 +16,12 @@ public void HasChild_Deserializes() f=>f.HasChild(hq=>hq .Query(qq=>Query2) .Scope("my_scope") - .Score(ChildScoreType.avg) + .Score(ChildScoreType.Average) ) ); q.Type.Should().Be("person"); q.Scope.Should().Be("my_scope"); - q.ScoreType.Should().Be(ChildScoreType.avg); + q.ScoreType.Should().Be(ChildScoreType.Average); AssertIsTermQuery(q.Query, Query2); } } diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/HasParentQueryTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/HasParentQueryTests.cs index 051cc796f79..9f067964f4a 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/HasParentQueryTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/HasParentQueryTests.cs @@ -16,13 +16,13 @@ public void HasParent_Deserializes() f=>f.HasParent(hp=>hp .Query(qq=>Query3) .Scope("my_scope") - .Score(ParentScoreType.score) + .Score(ParentScoreType.Score) ) ); q.Type.Should().Be("person"); q.Scope.Should().Be("my_scope"); - q.ScoreType.Should().Be(ParentScoreType.score); + q.ScoreType.Should().Be(ParentScoreType.Score); AssertIsTermQuery(q.Query, Query3); } } diff --git a/src/Tests/Nest.Tests.Unit/Search/Facets/DateHistogramFacetJson.cs b/src/Tests/Nest.Tests.Unit/Search/Facets/DateHistogramFacetJson.cs index e55bd00bfac..ed84d0aca62 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Facets/DateHistogramFacetJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Facets/DateHistogramFacetJson.cs @@ -42,7 +42,7 @@ public void DateHistogramRounding() .QueryRaw(@"{ raw : ""query""}") .FacetDateHistogram(h => h .OnField(f => f.StartedOn) - .Interval(DateInterval.Day, DateRounding.Half_Floor) + .Interval(DateInterval.Day, DateRounding.HalfFloor) ); var json = TestElasticClient.Serialize(s); var expected = @"{ from: 0, size: 10, @@ -66,7 +66,7 @@ public void DateHistogramTimeZone() .QueryRaw(@"{ raw : ""query""}") .FacetDateHistogram(h => h .OnField(f => f.StartedOn) - .Interval(DateInterval.Day, DateRounding.Half_Floor) + .Interval(DateInterval.Day, DateRounding.HalfFloor) .TimeZone("-2") ); var json = TestElasticClient.Serialize(s); @@ -92,7 +92,7 @@ public void DateHistogramTimeZones() .QueryRaw(@"{ raw : ""query""}") .FacetDateHistogram(h => h .OnField(f => f.StartedOn) - .Interval(DateInterval.Day, DateRounding.Half_Floor) + .Interval(DateInterval.Day, DateRounding.HalfFloor) .TimeZone("-2") //should be unset because we later specify pre_zone .TimeZones(Pre: "-3", Post: "-4") ); diff --git a/src/Tests/Nest.Tests.Unit/Search/Facets/TermsFacetJson.cs b/src/Tests/Nest.Tests.Unit/Search/Facets/TermsFacetJson.cs index e864f1d1600..c210e6aa546 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Facets/TermsFacetJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Facets/TermsFacetJson.cs @@ -84,7 +84,7 @@ public void TestTermFacetAllMultiFields() .Order(TermsOrder.reverse_count) .Exclude("term1", "term2") .AllTerms() - .Regex(@"\s+", EsRegexFlags.DOTALL) + .Regex(@"\s+", "DOTALL") .Script("term + 'aaa'") .ScriptField("_source.my_field") ); @@ -100,7 +100,7 @@ public void TestTermFacetAllMultiFields() .Order(TermsOrder.reverse_count) .Exclude("term1", "term2") .AllTerms() - .Regex(@"\s+", EsRegexFlags.DOTALL) + .Regex(@"\s+","DOTALL") .Script("term + 'aaa'") .ScriptField("_source.my_field") ); diff --git a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/HasChildQueryJson.cs b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/HasChildQueryJson.cs index caa5f822a65..d950bbcc460 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/HasChildQueryJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/HasChildQueryJson.cs @@ -16,7 +16,7 @@ public void HasChildThisQuery() .HasChild(fz => fz .Query(qq=>qq.Term(f=>f.FirstName, "john")) .Scope("my_scope") - .Score(ChildScoreType.avg) + .Score(ChildScoreType.Average) ) ); var json = TestElasticClient.Serialize(s); diff --git a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/HasParentQueryJson.cs b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/HasParentQueryJson.cs index 6f889851643..cc063c5507b 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/HasParentQueryJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/HasParentQueryJson.cs @@ -16,7 +16,7 @@ public void HasParentThisQuery() .HasParent(fz => fz .Query(qq=>qq.Term(f=>f.FirstName, "john")) .Scope("my_scope") - .Score(ParentScoreType.score) + .Score(ParentScoreType.Score) ) ); var json = TestElasticClient.Serialize(s); From 5c42a37f7ae8bb5af1c23fe7f3f927e7cd076914 Mon Sep 17 00:00:00 2001 From: gmarz Date: Wed, 25 Jun 2014 17:11:06 +0200 Subject: [PATCH 2/8] Standardized enums by the c# naming convention --- src/Nest/DSL/Search/SortFieldDescriptor.cs | 8 ++--- .../Attributes/ElasticPropertyAttribute.cs | 4 +-- .../Attributes/IElasticPropertyAttribute.cs | 2 +- .../Descriptors/BooleanMappingDescriptor.cs | 2 +- .../Descriptors/DateMappingDescriptor.cs | 2 +- .../Descriptors/NumberMappingDescriptor.cs | 2 +- .../Mapping/SpecialFields/TypeFieldMapping.cs | 2 +- src/Nest/Enums/GeoTree.cs | 14 +++----- src/Nest/Enums/GeoUnit.cs | 14 ++++---- src/Nest/Enums/HealthLevel.cs | 14 -------- src/Nest/Enums/HealthStatus.cs | 14 -------- src/Nest/Enums/HistogramComparatorType.cs | 13 ------- src/Nest/Enums/IndexOptions.cs | 16 ++++----- src/Nest/Enums/Lang.cs | 34 ------------------- src/Nest/Enums/NamingConvention.cs | 14 -------- src/Nest/Enums/NestedScore.cs | 15 ++++---- src/Nest/Enums/NodeInfoStats.cs | 23 ------------- src/Nest/Enums/NodesInfo.cs | 22 ------------ src/Nest/Enums/NumberType.cs | 19 ----------- src/Nest/Enums/NumericIndexOption.cs | 16 ++++----- src/Nest/Enums/NumericType.cs | 15 ++++---- src/Nest/Enums/Occur.cs | 13 ------- src/Nest/Enums/OpType.cs | 13 ------- src/Nest/Enums/Operator.cs | 13 +++---- src/Nest/Enums/Replication.cs | 13 ------- src/Nest/Enums/RewriteMultiTerm.cs | 19 +++++++---- src/Nest/Enums/ScoreMode.cs | 28 ++++++++------- src/Nest/Enums/SearchType.cs | 17 ---------- src/Nest/Enums/SortOrder.cs | 12 ------- src/Nest/Enums/StatsInfo.cs | 22 ------------ src/Nest/Enums/StoreOption.cs | 15 -------- src/Nest/Enums/TermVectorOption.cs | 19 +++++++---- src/Nest/Enums/TermsExecution.cs | 23 +++++++------ src/Nest/Enums/TermsStatsComparatorType.cs | 22 ------------ src/Nest/Enums/TextQueryType.cs | 23 +++++++------ src/Nest/Enums/TopChildrenScore.cs | 10 ++++-- src/Nest/Nest.csproj | 16 --------- .../WritePropertiesFromAttributeVisitor.cs | 10 +++--- .../Aggregations/BucketAggregationTests.cs | 2 +- .../Aggregations/ParseResponseItemsTests.cs | 2 +- .../Core/Map/Properties/PropertiesTests.cs | 8 ++--- .../Core/Map/TypeField/TypeFieldTests.cs | 2 +- .../IntegrationSetup.cs | 4 +-- .../Search/QueryDSLTests.cs | 2 +- .../Domain/ElasticsearchProject.cs | 2 +- .../DynamicTemplates/DynamicTemplatesTests.cs | 2 +- .../Core/Map/FluentMappingFullExampleTests.cs | 10 +++--- .../Core/Map/Properties/PropertiesTests.cs | 12 +++---- .../Core/Map/TypeField/TypeFieldTests.cs | 2 +- .../Filter/GeoDistanceFilterTests.cs | 2 +- .../Filter/GeoDistanceRangeFilterTests.cs | 4 +-- .../QueryParsers/Filter/NestedFilterTests.cs | 4 +-- .../QueryParsers/Filter/TermsFilterTests.cs | 4 +-- .../Queries/CommonTermsQueryTests.cs | 8 ++--- .../Queries/CustomFiltersScoreQueryTests.cs | 4 +-- .../QueryParsers/Queries/FuzzyQueryTests.cs | 4 +-- .../QueryParsers/Queries/MatchQueryTests.cs | 24 ++++++------- .../Queries/MultiMatchQueryTests.cs | 12 +++---- .../QueryParsers/Queries/NestedQueryTests.cs | 4 +-- .../QueryParsers/Queries/PrefixQueryTests.cs | 4 +-- .../Queries/QueryStringQueryTests.cs | 8 ++--- .../Queries/SimpleQueryStringQueryTests.cs | 4 +-- .../Queries/WildCardQueryTests.cs | 8 ++--- .../Search/Facets/GeoDistanceFacetJson.cs | 4 +-- .../Filter/Singles/GeoDistanceFilterJson.cs | 2 +- .../Singles/GeoDistanceRangeFilterJson.cs | 2 +- .../Search/Filter/Singles/TermsFilterJson.cs | 2 +- .../InitializerSyntax/InitializerExample.cs | 2 +- .../Singles/CommonTerms/CommonTermsTests.cs | 4 +-- .../Search/Query/Singles/MatchQueryJson.cs | 6 ++-- .../Search/Query/Singles/PrefixQueryJson.cs | 2 +- .../Query/Singles/QueryStringQueryJson.cs | 4 +-- .../SimpleQueryStringQueryJson.cs | 2 +- .../Query/Singles/TopChildrenQueryJson.cs | 2 +- .../Search/Query/Singles/WildcardQueryJson.cs | 2 +- .../Search/Sorting/SortTests.cs | 2 +- 76 files changed, 227 insertions(+), 504 deletions(-) delete mode 100644 src/Nest/Enums/HealthLevel.cs delete mode 100644 src/Nest/Enums/HealthStatus.cs delete mode 100644 src/Nest/Enums/HistogramComparatorType.cs delete mode 100644 src/Nest/Enums/Lang.cs delete mode 100644 src/Nest/Enums/NamingConvention.cs delete mode 100644 src/Nest/Enums/NodeInfoStats.cs delete mode 100644 src/Nest/Enums/NodesInfo.cs delete mode 100644 src/Nest/Enums/NumberType.cs delete mode 100644 src/Nest/Enums/Occur.cs delete mode 100644 src/Nest/Enums/OpType.cs delete mode 100644 src/Nest/Enums/Replication.cs delete mode 100644 src/Nest/Enums/SearchType.cs delete mode 100644 src/Nest/Enums/SortOrder.cs delete mode 100644 src/Nest/Enums/StatsInfo.cs delete mode 100644 src/Nest/Enums/StoreOption.cs delete mode 100644 src/Nest/Enums/TermsStatsComparatorType.cs diff --git a/src/Nest/DSL/Search/SortFieldDescriptor.cs b/src/Nest/DSL/Search/SortFieldDescriptor.cs index 158356f277d..330c9d48b18 100644 --- a/src/Nest/DSL/Search/SortFieldDescriptor.cs +++ b/src/Nest/DSL/Search/SortFieldDescriptor.cs @@ -125,25 +125,25 @@ public virtual SortFieldDescriptor Descending() public virtual SortFieldDescriptor NestedMin() { - Self.Mode = ScoreMode.min; + Self.Mode = ScoreMode.Min; return this; } public virtual SortFieldDescriptor NestedMax() { - Self.Mode = ScoreMode.max; + Self.Mode = ScoreMode.Max; return this; } public virtual SortFieldDescriptor NestedSum() { - Self.Mode = ScoreMode.sum; + Self.Mode = ScoreMode.Sum; return this; } public virtual SortFieldDescriptor NestedAvg() { - Self.Mode = ScoreMode.avg; + Self.Mode = ScoreMode.Average; return this; } diff --git a/src/Nest/Domain/Mapping/Attributes/ElasticPropertyAttribute.cs b/src/Nest/Domain/Mapping/Attributes/ElasticPropertyAttribute.cs index 71cee70eb57..43a0596ccea 100644 --- a/src/Nest/Domain/Mapping/Attributes/ElasticPropertyAttribute.cs +++ b/src/Nest/Domain/Mapping/Attributes/ElasticPropertyAttribute.cs @@ -35,7 +35,7 @@ public class ElasticPropertyAttribute : Attribute, IElasticPropertyAttribute /// /// Defaults to float so be sure to set this correctly! /// - public NumericType NumericType { get; set; } + public NumberType NumericType { get; set; } public int PrecisionStep { get; set; } /// @@ -47,7 +47,7 @@ public ElasticPropertyAttribute() { //make sure we match ES's defaults this.Boost = 1; - this.TermVector = TermVectorOption.no; + this.TermVector = TermVectorOption.No; this.Index = FieldIndexOption.analyzed; this.IncludeInAll = true; diff --git a/src/Nest/Domain/Mapping/Attributes/IElasticPropertyAttribute.cs b/src/Nest/Domain/Mapping/Attributes/IElasticPropertyAttribute.cs index f047e1f83a4..99fc773d1ea 100644 --- a/src/Nest/Domain/Mapping/Attributes/IElasticPropertyAttribute.cs +++ b/src/Nest/Domain/Mapping/Attributes/IElasticPropertyAttribute.cs @@ -31,7 +31,7 @@ public interface IElasticPropertyAttribute /// /// Defaults to float so be sure to set this correctly! /// - NumericType NumericType { get; set; } + NumberType NumericType { get; set; } int PrecisionStep { get; set; } /// diff --git a/src/Nest/Domain/Mapping/Descriptors/BooleanMappingDescriptor.cs b/src/Nest/Domain/Mapping/Descriptors/BooleanMappingDescriptor.cs index 6e903a5aa63..7314bb198bf 100644 --- a/src/Nest/Domain/Mapping/Descriptors/BooleanMappingDescriptor.cs +++ b/src/Nest/Domain/Mapping/Descriptors/BooleanMappingDescriptor.cs @@ -25,7 +25,7 @@ public BooleanMappingDescriptor IndexName(string indexName) this._Mapping.IndexName = indexName; return this; } - public BooleanMappingDescriptor Index(NonStringIndexOption index = NonStringIndexOption.analyzed) + public BooleanMappingDescriptor Index(NonStringIndexOption index = NonStringIndexOption.Analyzed) { this._Mapping.Index = index; return this; diff --git a/src/Nest/Domain/Mapping/Descriptors/DateMappingDescriptor.cs b/src/Nest/Domain/Mapping/Descriptors/DateMappingDescriptor.cs index b55abc99852..c0ca2d7c31a 100644 --- a/src/Nest/Domain/Mapping/Descriptors/DateMappingDescriptor.cs +++ b/src/Nest/Domain/Mapping/Descriptors/DateMappingDescriptor.cs @@ -24,7 +24,7 @@ public DateMappingDescriptor IndexName(string indexName) this._Mapping.IndexName = indexName; return this; } - public DateMappingDescriptor Index(NonStringIndexOption index = NonStringIndexOption.analyzed) + public DateMappingDescriptor Index(NonStringIndexOption index = NonStringIndexOption.Analyzed) { this._Mapping.Index = index; return this; diff --git a/src/Nest/Domain/Mapping/Descriptors/NumberMappingDescriptor.cs b/src/Nest/Domain/Mapping/Descriptors/NumberMappingDescriptor.cs index 35dc3b36600..035434d2a01 100644 --- a/src/Nest/Domain/Mapping/Descriptors/NumberMappingDescriptor.cs +++ b/src/Nest/Domain/Mapping/Descriptors/NumberMappingDescriptor.cs @@ -32,7 +32,7 @@ public NumberMappingDescriptor IndexName(string indexName) this._Mapping.IndexName = indexName; return this; } - public NumberMappingDescriptor Index(NonStringIndexOption index = NonStringIndexOption.analyzed) + public NumberMappingDescriptor Index(NonStringIndexOption index = NonStringIndexOption.Analyzed) { this._Mapping.Index = index; return this; diff --git a/src/Nest/Domain/Mapping/SpecialFields/TypeFieldMapping.cs b/src/Nest/Domain/Mapping/SpecialFields/TypeFieldMapping.cs index 6d3e08ab539..68c44f46594 100644 --- a/src/Nest/Domain/Mapping/SpecialFields/TypeFieldMapping.cs +++ b/src/Nest/Domain/Mapping/SpecialFields/TypeFieldMapping.cs @@ -12,7 +12,7 @@ public class TypeFieldMapping [JsonProperty("store"), JsonConverter(typeof(YesNoBoolConverter))] public bool? Store { get; internal set; } - public TypeFieldMapping SetIndexed(NonStringIndexOption index = NonStringIndexOption.analyzed) + public TypeFieldMapping SetIndexed(NonStringIndexOption index = NonStringIndexOption.Analyzed) { this.Index = index; return this; diff --git a/src/Nest/Enums/GeoTree.cs b/src/Nest/Enums/GeoTree.cs index 38ca88a2976..49accae3cca 100644 --- a/src/Nest/Enums/GeoTree.cs +++ b/src/Nest/Enums/GeoTree.cs @@ -1,16 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using System.Linq.Expressions; +using System.Runtime.Serialization; namespace Nest { public enum GeoTree { - geohash, - quadtree + [EnumMember(Value = "geohash")] + Geohash, + [EnumMember(Value = "quadtree")] + Quadtree } } diff --git a/src/Nest/Enums/GeoUnit.cs b/src/Nest/Enums/GeoUnit.cs index 1027510088a..7eca189d0c6 100644 --- a/src/Nest/Enums/GeoUnit.cs +++ b/src/Nest/Enums/GeoUnit.cs @@ -1,17 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Newtonsoft.Json; +using Newtonsoft.Json; using Newtonsoft.Json.Converters; -using System.Linq.Expressions; +using System.Runtime.Serialization; namespace Nest { [JsonConverter(typeof(StringEnumConverter))] public enum GeoUnit { - km, - mi + [EnumMember(Value = "km")] + Kilometers, + [EnumMember(Value = "mi")] + Miles } } diff --git a/src/Nest/Enums/HealthLevel.cs b/src/Nest/Enums/HealthLevel.cs deleted file mode 100644 index d9bbcf24087..00000000000 --- a/src/Nest/Enums/HealthLevel.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Nest -{ - public enum HealthLevel - { - Cluster, //default in ES - Indices, - Shards - } -} diff --git a/src/Nest/Enums/HealthStatus.cs b/src/Nest/Enums/HealthStatus.cs deleted file mode 100644 index 3fd1a613c63..00000000000 --- a/src/Nest/Enums/HealthStatus.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Nest -{ - public enum HealthStatus - { - Green, - Yellow, - Red - } -} diff --git a/src/Nest/Enums/HistogramComparatorType.cs b/src/Nest/Enums/HistogramComparatorType.cs deleted file mode 100644 index 12fa6d7dfd2..00000000000 --- a/src/Nest/Enums/HistogramComparatorType.cs +++ /dev/null @@ -1,13 +0,0 @@ -// ReSharper disable InconsistentNaming -// ReSharper disable CheckNamespace -namespace Nest -{ - public enum HistogramComparatorType - { - KEY, - COUNT, - TOTAL - } -} -// ReSharper restore CheckNamespace -// ReSharper restore InconsistentNaming \ No newline at end of file diff --git a/src/Nest/Enums/IndexOptions.cs b/src/Nest/Enums/IndexOptions.cs index 6b247f6a71b..c252e78957e 100644 --- a/src/Nest/Enums/IndexOptions.cs +++ b/src/Nest/Enums/IndexOptions.cs @@ -1,16 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Runtime.Serialization; namespace Nest { public enum IndexOptions { - docs, - freqs, - positions + [EnumMember(Value="docs")] + Docs, + [EnumMember(Value = "freqs")] + Freqs, + [EnumMember(Value = "positions")] + Positions } - - } diff --git a/src/Nest/Enums/Lang.cs b/src/Nest/Enums/Lang.cs deleted file mode 100644 index 049a7f6d343..00000000000 --- a/src/Nest/Enums/Lang.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Nest -{ - /// - /// Scripting Language. - /// - public enum Lang - { - /// - /// Language Mvel. - /// - mvel, - /// - /// Language Java Script. - /// - js, - /// - /// Language Groovy - /// - groovy, - /// - /// Language Python - /// - python, - /// - /// Native - /// - native - } -} diff --git a/src/Nest/Enums/NamingConvention.cs b/src/Nest/Enums/NamingConvention.cs deleted file mode 100644 index 55c323fafa1..00000000000 --- a/src/Nest/Enums/NamingConvention.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Nest -{ - public enum NamingConvention - { - None, - mixedCase, - underscore_case - } -} diff --git a/src/Nest/Enums/NestedScore.cs b/src/Nest/Enums/NestedScore.cs index 77a77bed04d..ff93c04f812 100644 --- a/src/Nest/Enums/NestedScore.cs +++ b/src/Nest/Enums/NestedScore.cs @@ -3,16 +3,19 @@ using System.Linq; using System.Text; using Newtonsoft.Json; +using System.Runtime.Serialization; namespace Nest { public enum NestedScore { - avg, - total, - max, - none + [EnumMember(Value = "avg")] + Average, + [EnumMember(Value = "total")] + Total, + [EnumMember(Value = "max")] + Max, + [EnumMember(Value = "none")] + None } - - } diff --git a/src/Nest/Enums/NodeInfoStats.cs b/src/Nest/Enums/NodeInfoStats.cs deleted file mode 100644 index 50d984a00e0..00000000000 --- a/src/Nest/Enums/NodeInfoStats.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Nest -{ - [Flags] - public enum NodeInfoStats - { - None = 0, - Indices = 1 << 1, - OS = 1 << 2, - Process = 1 << 3, - JVM = 1 << 4, - ThreadPool = 1 << 5, - Network = 1 << 6, - Transport = 1 << 7, - HTTP = 1 << 8, - FileSystem = 1 << 9, - All = Indices | OS | Process | JVM | ThreadPool | Network | Transport | HTTP | FileSystem - } -} diff --git a/src/Nest/Enums/NodesInfo.cs b/src/Nest/Enums/NodesInfo.cs deleted file mode 100644 index 338ff62e6f9..00000000000 --- a/src/Nest/Enums/NodesInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Nest -{ - [Flags] - public enum NodesInfo - { - None = 0, - Settings = 1 << 1, - OS = 1 << 2, - Process = 1 << 3, - JVM = 1 << 4, - ThreadPool = 1 << 5, - Network = 1 << 6, - Transport = 1 << 7, - HTTP = 1 << 8, - All = Settings | OS | Process | JVM | ThreadPool | Network | Transport | HTTP - } -} diff --git a/src/Nest/Enums/NumberType.cs b/src/Nest/Enums/NumberType.cs deleted file mode 100644 index 98c75668f87..00000000000 --- a/src/Nest/Enums/NumberType.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Nest -{ - public enum NumberType - { - @double, - @float, - @byte, - @short, - @integer, - @long - - } - -} diff --git a/src/Nest/Enums/NumericIndexOption.cs b/src/Nest/Enums/NumericIndexOption.cs index 2dffbedca35..cfc94da3cd3 100644 --- a/src/Nest/Enums/NumericIndexOption.cs +++ b/src/Nest/Enums/NumericIndexOption.cs @@ -1,16 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Runtime.Serialization; namespace Nest { public enum NonStringIndexOption { - no, - analyzed, - not_analyzed + [EnumMember(Value = "no")] + No, + [EnumMember(Value = "analyzed")] + Analyzed, + [EnumMember(Value = "not_analyzed")] + NotAnalyzed } - - } diff --git a/src/Nest/Enums/NumericType.cs b/src/Nest/Enums/NumericType.cs index 84071f88ab1..efc64d9d334 100644 --- a/src/Nest/Enums/NumericType.cs +++ b/src/Nest/Enums/NumericType.cs @@ -1,19 +1,22 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Runtime.Serialization; namespace Nest { - public enum NumericType + public enum NumberType { + [EnumMember(Value = "default")] Default, + [EnumMember(Value = "float")] Float, + [EnumMember(Value = "double")] Double, + [EnumMember(Value = "integer")] Integer, + [EnumMember(Value = "long")] Long, + [EnumMember(Value = "short")] Short, + [EnumMember(Value = "byte")] Byte } - } diff --git a/src/Nest/Enums/Occur.cs b/src/Nest/Enums/Occur.cs deleted file mode 100644 index b56c7ed677f..00000000000 --- a/src/Nest/Enums/Occur.cs +++ /dev/null @@ -1,13 +0,0 @@ -// ReSharper disable InconsistentNaming -// ReSharper disable CheckNamespace -namespace Nest -{ - public enum Occur - { - MUST, - MUST_NOT, - SHOULD - } -} -// ReSharper restore CheckNamespace -// ReSharper restore InconsistentNaming \ No newline at end of file diff --git a/src/Nest/Enums/OpType.cs b/src/Nest/Enums/OpType.cs deleted file mode 100644 index bbe5b9c1d71..00000000000 --- a/src/Nest/Enums/OpType.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Nest -{ - public enum OpType - { - None, // default in ES - Create - } -} diff --git a/src/Nest/Enums/Operator.cs b/src/Nest/Enums/Operator.cs index f9a1b1dbce4..3580bbdc499 100644 --- a/src/Nest/Enums/Operator.cs +++ b/src/Nest/Enums/Operator.cs @@ -1,15 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Runtime.Serialization; namespace Nest { public enum Operator { - and, - or + [EnumMember(Value = "and")] + And, + [EnumMember(Value = "or")] + Or } - - } diff --git a/src/Nest/Enums/Replication.cs b/src/Nest/Enums/Replication.cs deleted file mode 100644 index 7c5171e6a36..00000000000 --- a/src/Nest/Enums/Replication.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Nest -{ - public enum Replication - { - Sync, //default in ES - Async - } -} diff --git a/src/Nest/Enums/RewriteMultiTerm.cs b/src/Nest/Enums/RewriteMultiTerm.cs index 91a3239b4e3..6e6d4b5627c 100644 --- a/src/Nest/Enums/RewriteMultiTerm.cs +++ b/src/Nest/Enums/RewriteMultiTerm.cs @@ -4,6 +4,7 @@ using System.Text; using Newtonsoft.Json; using Newtonsoft.Json.Converters; +using System.Runtime.Serialization; namespace Nest { @@ -11,11 +12,17 @@ namespace Nest [JsonConverter(typeof(StringEnumConverter))] public enum RewriteMultiTerm { - constant_score_default, - scoring_boolean, - constant_score_boolean, - constant_score_filter, - top_terms_N, - top_terms_boost_N + [EnumMember(Value = "constant_score_default")] + ConstantScoreDefault, + [EnumMember(Value = "scoring_boolean")] + ScoringBoolean, + [EnumMember(Value = "constant_score_boolean")] + ConstantScoreBoolean, + [EnumMember(Value = "constant_score_filter")] + ConstantScoreFilter, + [EnumMember(Value = "top_terms_N")] + TopTermsN, + [EnumMember(Value = "top_terms_boost_N")] + TopTermsBoostN } } diff --git a/src/Nest/Enums/ScoreMode.cs b/src/Nest/Enums/ScoreMode.cs index 5d661c0a004..8824c2b11ea 100644 --- a/src/Nest/Enums/ScoreMode.cs +++ b/src/Nest/Enums/ScoreMode.cs @@ -1,21 +1,25 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Newtonsoft.Json; +using Newtonsoft.Json; using Newtonsoft.Json.Converters; +using System.Runtime.Serialization; namespace Nest { [JsonConverter(typeof(StringEnumConverter))] public enum ScoreMode { - avg, - first, - max, - min, - multiply, - total, - sum + [EnumMember(Value = "avg")] + Average, + [EnumMember(Value = "first")] + First, + [EnumMember(Value = "max")] + Max, + [EnumMember(Value = "min")] + Min, + [EnumMember(Value = "multiply")] + Multiply, + [EnumMember(Value = "total")] + Total, + [EnumMember(Value = "sum")] + Sum } } diff --git a/src/Nest/Enums/SearchType.cs b/src/Nest/Enums/SearchType.cs deleted file mode 100644 index 2a729f0f33b..00000000000 --- a/src/Nest/Enums/SearchType.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Nest -{ - public enum SearchType - { - QueryAndFetch, - QueryThenFetch, - DfsQueryThenFetch, - DfsQueryAndFetch, - Count, - Scan - } -} diff --git a/src/Nest/Enums/SortOrder.cs b/src/Nest/Enums/SortOrder.cs deleted file mode 100644 index fd822c99ca9..00000000000 --- a/src/Nest/Enums/SortOrder.cs +++ /dev/null @@ -1,12 +0,0 @@ -// ReSharper disable InconsistentNaming -// ReSharper disable CheckNamespace -//namespace Nest -//{ -// public enum SortOrder -// { -// ASC, -// DESC -// } -//} -// ReSharper restore CheckNamespace -// ReSharper restore InconsistentNaming \ No newline at end of file diff --git a/src/Nest/Enums/StatsInfo.cs b/src/Nest/Enums/StatsInfo.cs deleted file mode 100644 index a824b01747f..00000000000 --- a/src/Nest/Enums/StatsInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Nest -{ - [Flags] - public enum StatsInfo - { - None = 0x0, - Docs = 0x1, - Store = 0x2, - Indexing = 0x4, - Get = 0x8, - Search = 0x10, - Merge = 0x20, - Flush = 0x40, - All = Docs | Store | Indexing | Get | Search | Merge | Flush - - } -} diff --git a/src/Nest/Enums/StoreOption.cs b/src/Nest/Enums/StoreOption.cs deleted file mode 100644 index de95c29d38d..00000000000 --- a/src/Nest/Enums/StoreOption.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Nest -{ - public enum StoreOption - { - No, - Yes - } - - -} diff --git a/src/Nest/Enums/TermVectorOption.cs b/src/Nest/Enums/TermVectorOption.cs index 99618bc6688..4cb4b2da8d4 100644 --- a/src/Nest/Enums/TermVectorOption.cs +++ b/src/Nest/Enums/TermVectorOption.cs @@ -4,17 +4,24 @@ using System.Text; using Newtonsoft.Json; using Newtonsoft.Json.Converters; +using System.Runtime.Serialization; namespace Nest { [JsonConverter(typeof(StringEnumConverter))] public enum TermVectorOption { - no, - yes, - with_offsets, - with_positions, - with_positions_offsets, - with_positions_offsets_payloads + [EnumMember(Value = "no")] + No, + [EnumMember(Value = "yes")] + Yes, + [EnumMember(Value = "with_offsets")] + WithOffsets, + [EnumMember(Value = "with_positions")] + WithPositions, + [EnumMember(Value = "with_positions_offsets")] + WithPositionsOffsets, + [EnumMember(Value = "with_positions_offsets_payloads")] + WithPositionsOffsetsPayloads } } diff --git a/src/Nest/Enums/TermsExecution.cs b/src/Nest/Enums/TermsExecution.cs index 884196bca03..1b93c43bbd6 100644 --- a/src/Nest/Enums/TermsExecution.cs +++ b/src/Nest/Enums/TermsExecution.cs @@ -1,20 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Newtonsoft.Json; +using Newtonsoft.Json; using Newtonsoft.Json.Converters; -using System.Linq.Expressions; +using System.Runtime.Serialization; namespace Nest { [JsonConverter(typeof(StringEnumConverter))] public enum TermsExecution { - plain, - @bool, - and, - or, - fielddata + [EnumMember(Value = "plain")] + Plain, + [EnumMember(Value = "bool")] + Bool, + [EnumMember(Value = "and")] + And, + [EnumMember(Value = "or")] + Or, + [EnumMember(Value = "fielddata")] + FieldData } } diff --git a/src/Nest/Enums/TermsStatsComparatorType.cs b/src/Nest/Enums/TermsStatsComparatorType.cs deleted file mode 100644 index e4876a12e3b..00000000000 --- a/src/Nest/Enums/TermsStatsComparatorType.cs +++ /dev/null @@ -1,22 +0,0 @@ -// ReSharper disable InconsistentNaming -// ReSharper disable CheckNamespace -namespace Nest -{ - public enum TermsStatsComparatorType - { - COUNT, - REVERSE_COUNT, - TERM, - REVERSE_TERM, - TOTAL, - REVERSE_TOTAL, - MIN, - REVERSE_MIN, - MAX, - REVERSE_MAX, - MEAN, - REVERSE_MEAN - } -} -// ReSharper restore CheckNamespace -// ReSharper restore InconsistentNaming \ No newline at end of file diff --git a/src/Nest/Enums/TextQueryType.cs b/src/Nest/Enums/TextQueryType.cs index fe5ef023ceb..d6d90acf2e8 100644 --- a/src/Nest/Enums/TextQueryType.cs +++ b/src/Nest/Enums/TextQueryType.cs @@ -1,15 +1,18 @@ -// ReSharper disable InconsistentNaming -// ReSharper disable CheckNamespace +using System.Runtime.Serialization; + namespace Nest { public enum TextQueryType { - BEST_FIELDS, - MOST_FIELDS, - CROSS_FIELDS, - PHRASE, - PHRASE_PREFIX + [EnumMember(Value = "best_fields")] + BestFields, + [EnumMember(Value = "most_fields")] + MostFields, + [EnumMember(Value = "cross_fields")] + CrossFields, + [EnumMember(Value = "phrase")] + Phrase, + [EnumMember(Value = "phrase_prefix")] + PhrasePrefix } -} -// ReSharper restore CheckNamespace -// ReSharper restore InconsistentNaming \ No newline at end of file +} \ No newline at end of file diff --git a/src/Nest/Enums/TopChildrenScore.cs b/src/Nest/Enums/TopChildrenScore.cs index c67bba4c294..1962bfa19b8 100644 --- a/src/Nest/Enums/TopChildrenScore.cs +++ b/src/Nest/Enums/TopChildrenScore.cs @@ -3,14 +3,18 @@ using System.Linq; using System.Text; using Newtonsoft.Json; +using System.Runtime.Serialization; namespace Nest { public enum TopChildrenScore { - max, - sum, - avg + [EnumMember(Value="max")] + Max, + [EnumMember(Value = "sum")] + Sum, + [EnumMember(Value = "avg")] + Average } diff --git a/src/Nest/Nest.csproj b/src/Nest/Nest.csproj index 199350f948c..1d2b7ad4250 100644 --- a/src/Nest/Nest.csproj +++ b/src/Nest/Nest.csproj @@ -604,24 +604,12 @@ - - - - - - - - - - - - @@ -756,7 +744,6 @@ - @@ -796,7 +783,6 @@ - @@ -817,10 +803,8 @@ - - diff --git a/src/Nest/Resolvers/Writers/WritePropertiesFromAttributeVisitor.cs b/src/Nest/Resolvers/Writers/WritePropertiesFromAttributeVisitor.cs index 188938ec558..19937c5d943 100644 --- a/src/Nest/Resolvers/Writers/WritePropertiesFromAttributeVisitor.cs +++ b/src/Nest/Resolvers/Writers/WritePropertiesFromAttributeVisitor.cs @@ -32,10 +32,10 @@ public void VisitBaseAttribute(IElasticPropertyAttribute att) { this._jsonWriter.WritePropertyName(this._propertyName); this._jsonWriter.WriteStartObject(); } - if (att.NumericType != NumericType.Default) + if (att.NumericType != NumberType.Default) { this._jsonWriter.WritePropertyName("type"); - string numericType = Enum.GetName(typeof (NumericType), att.NumericType); + string numericType = Enum.GetName(typeof (NumberType), att.NumericType); this._jsonWriter.WriteValue(numericType.ToLowerInvariant()); } else @@ -78,7 +78,7 @@ public void VisitBaseAttribute(IElasticPropertyAttribute att) { this._jsonWriter.WritePropertyName("index"); this._jsonWriter.WriteValue(Enum.GetName(typeof (FieldIndexOption), att.Index)); } - if (att.TermVector != TermVectorOption.no) + if (att.TermVector != TermVectorOption.No) { this._jsonWriter.WritePropertyName("term_vector"); this._jsonWriter.WriteValue(Enum.GetName(typeof (TermVectorOption), att.TermVector)); @@ -130,10 +130,10 @@ public void VisitBaseAttribute(IElasticPropertyAttribute att) { this._jsonWriter.WritePropertyName("sort"); this._jsonWriter.WriteStartObject(); - if (att.NumericType != NumericType.Default) + if (att.NumericType != NumberType.Default) { this._jsonWriter.WritePropertyName("type"); - string numericType = Enum.GetName(typeof (NumericType), att.NumericType); + string numericType = Enum.GetName(typeof (NumberType), att.NumericType); this._jsonWriter.WriteValue(numericType.ToLowerInvariant()); } else diff --git a/src/Tests/Nest.Tests.Integration/Aggregations/BucketAggregationTests.cs b/src/Tests/Nest.Tests.Integration/Aggregations/BucketAggregationTests.cs index daf6eda5c47..f0a5f49f33e 100644 --- a/src/Tests/Nest.Tests.Integration/Aggregations/BucketAggregationTests.cs +++ b/src/Tests/Nest.Tests.Integration/Aggregations/BucketAggregationTests.cs @@ -209,7 +209,7 @@ public void GeoDistance() .GeoDistance("bucket_agg", dh => dh .Field(p => p.Origin) .Origin(28.0, 28.0) - .Unit(GeoUnit.km) + .Unit(GeoUnit.Kilometers) .Ranges( r => r.To(1), r => r.From(1).To(100) diff --git a/src/Tests/Nest.Tests.Integration/Aggregations/ParseResponseItemsTests.cs b/src/Tests/Nest.Tests.Integration/Aggregations/ParseResponseItemsTests.cs index efed77c6339..f250e1d7619 100644 --- a/src/Tests/Nest.Tests.Integration/Aggregations/ParseResponseItemsTests.cs +++ b/src/Tests/Nest.Tests.Integration/Aggregations/ParseResponseItemsTests.cs @@ -113,7 +113,7 @@ public void GeoDistanceItem() .GeoDistance("my_geod", dh=>dh .Field(p=>p.Origin) .Origin(28.0, 28.0) - .Unit(GeoUnit.km) + .Unit(GeoUnit.Kilometers) .Ranges( r=>r.To(1), r=>r.From(1).To(100) diff --git a/src/Tests/Nest.Tests.Integration/Core/Map/Properties/PropertiesTests.cs b/src/Tests/Nest.Tests.Integration/Core/Map/Properties/PropertiesTests.cs index d7cd1f84941..168835d0f84 100644 --- a/src/Tests/Nest.Tests.Integration/Core/Map/Properties/PropertiesTests.cs +++ b/src/Tests/Nest.Tests.Integration/Core/Map/Properties/PropertiesTests.cs @@ -23,13 +23,13 @@ public void StringProperty() .IncludeInAll() .Index(FieldIndexOption.analyzed) .IndexAnalyzer("standard") - .IndexOptions(IndexOptions.positions) + .IndexOptions(IndexOptions.Positions) .NullValue("my_special_null_value") .OmitNorms() .PositionOffsetGap(1) .SearchAnalyzer("standard") .Store() - .TermVector(TermVectorOption.with_positions_offsets) + .TermVector(TermVectorOption.WithPositionsOffsets) .Boost(1.1) ) ) @@ -53,7 +53,7 @@ public void NumberProperty() .Number(s => s .Name(p => p.LOC) .IndexName("lines_of_code") - .Type(NumberType.@integer) + .Type(NumberType.Integer) .NullValue(0) .Boost(2.0) .IgnoreMalformed() @@ -275,7 +275,7 @@ public void GeoShapeProperty() .Properties(props => props .GeoShape(s => s .Name(p => p.MyGeoShape) - .Tree(GeoTree.geohash) + .Tree(GeoTree.Geohash) .TreeLevels(2) .DistanceErrorPercentage(0.025) ) diff --git a/src/Tests/Nest.Tests.Integration/Core/Map/TypeField/TypeFieldTests.cs b/src/Tests/Nest.Tests.Integration/Core/Map/TypeField/TypeFieldTests.cs index 67fefbb7752..6e5f3814eb9 100644 --- a/src/Tests/Nest.Tests.Integration/Core/Map/TypeField/TypeFieldTests.cs +++ b/src/Tests/Nest.Tests.Integration/Core/Map/TypeField/TypeFieldTests.cs @@ -23,7 +23,7 @@ public void TypeFieldSerializesNo() { var result = this._client.Map(m => m .TypeField(t => t - .SetIndexed(NonStringIndexOption.no) + .SetIndexed(NonStringIndexOption.No) .SetStored(false) ) ); diff --git a/src/Tests/Nest.Tests.Integration/IntegrationSetup.cs b/src/Tests/Nest.Tests.Integration/IntegrationSetup.cs index c9563825363..e97d7341df8 100644 --- a/src/Tests/Nest.Tests.Integration/IntegrationSetup.cs +++ b/src/Tests/Nest.Tests.Integration/IntegrationSetup.cs @@ -30,7 +30,7 @@ public static void Setup() .AddMapping(m => m .MapFromAttributes() .Properties(p => p - .String(s => s.Name(ep => ep.Content).TermVector(TermVectorOption.with_positions_offsets_payloads)))) + .String(s => s.Name(ep => ep.Content).TermVector(TermVectorOption.WithPositionsOffsetsPayloads)))) .AddMapping(m => m.MapFromAttributes()) .AddMapping(m => m.Properties(pp=>pp .String(sm => sm.Name(p => p.Name1).Index(FieldIndexOption.not_analyzed)) @@ -44,7 +44,7 @@ public static void Setup() .AddMapping(m => m .MapFromAttributes() .Properties(p => p - .String(s => s.Name(ep => ep.Content).TermVector(TermVectorOption.with_positions_offsets_payloads)))) + .String(s => s.Name(ep => ep.Content).TermVector(TermVectorOption.WithPositionsOffsetsPayloads)))) .AddMapping(m => m.MapFromAttributes()) .AddMapping(m => m.Properties(pp => pp .String(sm => sm.Name(p => p.Name1).Index(FieldIndexOption.not_analyzed)) diff --git a/src/Tests/Nest.Tests.Integration/Search/QueryDSLTests.cs b/src/Tests/Nest.Tests.Integration/Search/QueryDSLTests.cs index 1fe0ddda7a6..f023ee632c8 100644 --- a/src/Tests/Nest.Tests.Integration/Search/QueryDSLTests.cs +++ b/src/Tests/Nest.Tests.Integration/Search/QueryDSLTests.cs @@ -92,7 +92,7 @@ public void TestWildcardQueryBoostAndRewrite() .SortAscending(f => f.LOC) .SortDescending(f => f.Name) .Query(q => q - .Wildcard(f => f.Name, "elasticsearch.*", Boost: 1.0, Rewrite: RewriteMultiTerm.scoring_boolean) + .Wildcard(f => f.Name, "elasticsearch.*", Boost: 1.0, Rewrite: RewriteMultiTerm.ScoringBoolean) ) ); Assert.NotNull(results); diff --git a/src/Tests/Nest.Tests.MockData/Domain/ElasticsearchProject.cs b/src/Tests/Nest.Tests.MockData/Domain/ElasticsearchProject.cs index e151e6495c1..668415b8c7c 100644 --- a/src/Tests/Nest.Tests.MockData/Domain/ElasticsearchProject.cs +++ b/src/Tests/Nest.Tests.MockData/Domain/ElasticsearchProject.cs @@ -46,7 +46,7 @@ public class ElasticsearchProject public int LocScriptField { get; set; } - [ElasticProperty(NumericType=NumericType.Long)] + [ElasticProperty(NumericType=NumberType.Long)] public int StupidIntIWantAsLong { get; set; } public string MyAttachment { get; set; } diff --git a/src/Tests/Nest.Tests.Unit/Core/Map/DynamicTemplates/DynamicTemplatesTests.cs b/src/Tests/Nest.Tests.Unit/Core/Map/DynamicTemplates/DynamicTemplatesTests.cs index f14970598c1..f9af80141b2 100644 --- a/src/Tests/Nest.Tests.Unit/Core/Map/DynamicTemplates/DynamicTemplatesTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/Map/DynamicTemplates/DynamicTemplatesTests.cs @@ -74,7 +74,7 @@ public void MultipleTemplates() .Name("numbers") .Match("nu_*") .MatchMappingType("integer") - .Mapping(tm => tm.Number(sm => sm.Type(NumberType.integer).NullValue(4))) + .Mapping(tm => tm.Number(sm => sm.Type(NumberType.Integer).NullValue(4))) ) ) ); diff --git a/src/Tests/Nest.Tests.Unit/Core/Map/FluentMappingFullExampleTests.cs b/src/Tests/Nest.Tests.Unit/Core/Map/FluentMappingFullExampleTests.cs index 8d70a8a1dfd..017f548206b 100644 --- a/src/Tests/Nest.Tests.Unit/Core/Map/FluentMappingFullExampleTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/Map/FluentMappingFullExampleTests.cs @@ -40,7 +40,7 @@ public void MapFluentFull() .Enabled() .IndexAnalyzer("nGram_analyzer") .SearchAnalyzer("whitespace_analyzer") - .TermVector(TermVectorOption.with_positions_offsets) + .TermVector(TermVectorOption.WithPositionsOffsets) ) .DisableIndexField(false) .DisableSizeField(false) @@ -131,20 +131,20 @@ public void MapFluentFull() .IncludeInAll() .Index(FieldIndexOption.analyzed) .IndexAnalyzer("standard") - .IndexOptions(IndexOptions.positions) + .IndexOptions(IndexOptions.Positions) .NullValue("my_special_null_value") .OmitNorms() .PositionOffsetGap(1) .SearchAnalyzer("standard") .Store() - .TermVector(TermVectorOption.with_positions_offsets) + .TermVector(TermVectorOption.WithPositionsOffsets) .Boost(1.1) .CopyTo(p => p.Content) ) .Number(s => s .Name(p => p.LOC) .IndexName("lines_of_code") - .Type(NumberType.@integer) + .Type(NumberType.Integer) .NullValue(0) .Boost(2.0) .IgnoreMalformed() @@ -235,7 +235,7 @@ public void MapFluentFull() ) .GeoShape(s => s .Name(p => p.MyGeoShape) - .Tree(GeoTree.geohash) + .Tree(GeoTree.Geohash) .TreeLevels(2) .DistanceErrorPercentage(0.025) ) diff --git a/src/Tests/Nest.Tests.Unit/Core/Map/Properties/PropertiesTests.cs b/src/Tests/Nest.Tests.Unit/Core/Map/Properties/PropertiesTests.cs index ee74f874d10..1510e4cf8db 100644 --- a/src/Tests/Nest.Tests.Unit/Core/Map/Properties/PropertiesTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/Map/Properties/PropertiesTests.cs @@ -21,13 +21,13 @@ public void StringProperty() .IncludeInAll() .Index(FieldIndexOption.analyzed) .IndexAnalyzer("standard") - .IndexOptions(IndexOptions.positions) + .IndexOptions(IndexOptions.Positions) .NullValue("my_special_null_value") .OmitNorms() .PositionOffsetGap(1) .SearchAnalyzer("standard") .Store() - .TermVector(TermVectorOption.with_positions_offsets) + .TermVector(TermVectorOption.WithPositionsOffsets) .Boost(1.1) .CopyTo(p => p.Content, p => p.Country) ) @@ -43,7 +43,7 @@ public void NumberProperty() .Number(s => s .Name(p => p.LOC) .IndexName("lines_of_code") - .Type(NumberType.@integer) + .Type(NumberType.Integer) .NullValue(0) .Boost(2.0) .IgnoreMalformed() @@ -280,7 +280,7 @@ public void GeoShapeProperty() .Properties(props => props .GeoShape(s => s .Name(p => p.MyGeoShape) - .Tree(GeoTree.geohash) + .Tree(GeoTree.Geohash) .TreeLevels(2) .DistanceErrorPercentage(0.025) ) @@ -306,10 +306,10 @@ public void DocValuesProperty() .Properties(props => props .Number(nmd => nmd .Name("id") - .Type(NumberType.integer)) + .Type(NumberType.Integer)) .Number(nmd => nmd .Name("value") - .Type(NumberType.integer) + .Type(NumberType.Integer) .DocValues()))); this.JsonEquals(result2.ConnectionStatus.Request, MethodInfo.GetCurrentMethod()); } diff --git a/src/Tests/Nest.Tests.Unit/Core/Map/TypeField/TypeFieldTests.cs b/src/Tests/Nest.Tests.Unit/Core/Map/TypeField/TypeFieldTests.cs index 3ff85261ee5..1e7c43e32af 100644 --- a/src/Tests/Nest.Tests.Unit/Core/Map/TypeField/TypeFieldTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/Map/TypeField/TypeFieldTests.cs @@ -25,7 +25,7 @@ public void TypeFieldSerializesNo() { var result = this._client.Map(m => m .TypeField(t => t - .SetIndexed(NonStringIndexOption.no) + .SetIndexed(NonStringIndexOption.No) .SetStored(false) ) ); diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoDistanceFilterTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoDistanceFilterTests.cs index f3ffa35cd83..eb45ab0585f 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoDistanceFilterTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoDistanceFilterTests.cs @@ -13,7 +13,7 @@ public void GeoDistance_Deserializes(string cacheName, string cacheKey, bool cac var geoDistanceFilter = this.SerializeThenDeserialize(cacheName, cacheKey, cache, f=>f.GeoDistance, f=>f.GeoDistance(p=>p.Origin, gd=>gd - .Distance(1.0, GeoUnit.km) + .Distance(1.0, GeoUnit.Kilometers) .Location(2.1, 4.1) .Optimize(GeoOptimizeBBox.indexed) ) diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoDistanceRangeFilterTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoDistanceRangeFilterTests.cs index 2eb9acc9e58..4dc5b5dc933 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoDistanceRangeFilterTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoDistanceRangeFilterTests.cs @@ -14,7 +14,7 @@ public void GeoDistanceRange_Deserializes(string cacheName, string cacheKey, boo f=>f.GeoDistanceRange, f=>f.GeoDistanceRange(p=>p.Origin, d=>d .Location(Lat: 40, Lon: -70) - .Distance(From: 12, To: 200, Unit: GeoUnit.km) + .Distance(From: 12, To: 200, Unit: GeoUnit.Kilometers) .FromExclusive() .ToExclusive() .DistanceType(GeoDistanceType.arc) @@ -26,7 +26,7 @@ public void GeoDistanceRange_Deserializes(string cacheName, string cacheKey, boo var from = (double)(geoDistanceRangeFilter.From); from.Should().Be(12); - geoDistanceRangeFilter.Unit.Should().Be(GeoUnit.km); + geoDistanceRangeFilter.Unit.Should().Be(GeoUnit.Kilometers); geoDistanceRangeFilter.DistanceType.Should().Be(GeoDistanceType.arc); } diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/NestedFilterTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/NestedFilterTests.cs index ba062cc4b07..e4fda6f7651 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/NestedFilterTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/NestedFilterTests.cs @@ -14,14 +14,14 @@ public void Nested_Deserializes(string cacheName, string cacheKey, bool cache) f=>f.Nested, f=>f.Nested(n=>n .Scope("my-scope") - .Score(NestedScore.max) + .Score(NestedScore.Max) .Path(p=>p.Followers[0]) .Query(q=>q.Term(p=>p.Followers[0].FirstName,"elasticsearch.pm")) ) ); nestedFilter.Path.Should().Be("followers"); nestedFilter.Scope.Should().Be("my-scope"); - nestedFilter.Score.Should().Be(NestedScore.max); + nestedFilter.Score.Should().Be(NestedScore.Max); var query = nestedFilter.Query; query.Should().NotBeNull(); var termQuery = query.Term; diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/TermsFilterTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/TermsFilterTests.cs index 476c8d831d9..6b54341d06f 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/TermsFilterTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/TermsFilterTests.cs @@ -33,12 +33,12 @@ public void TermsFilter_Deserializes(string cacheName, string cacheKey, bool cac { var termsBaseFilter = this.SerializeThenDeserialize(cacheName, cacheKey, cache, f=>f.Terms, - f=>f.Terms(p => p.Name, new [] {"elasticsearch.pm"}, Execution:TermsExecution.@bool) + f=>f.Terms(p => p.Name, new [] {"elasticsearch.pm"}, Execution:TermsExecution.Bool) ); termsBaseFilter.Field.Should().Be("name"); var termsFilter = termsBaseFilter as ITermsFilter; termsFilter.Should().NotBeNull(); - termsFilter.Execution.Should().Be(TermsExecution.@bool); + termsFilter.Execution.Should().Be(TermsExecution.Bool); termsFilter.Terms.Should().BeEquivalentTo(new []{"elasticsearch.pm"}); } diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/CommonTermsQueryTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/CommonTermsQueryTests.cs index 238f1c58a0e..c38764f7da8 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/CommonTermsQueryTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/CommonTermsQueryTests.cs @@ -16,8 +16,8 @@ public void CommonTerms_Deserializes() .Boost(1.1) .CutOffFrequency(2.0) .DisableCoord() - .HighFrequencyOperator(Operator.or) - .LowFrequencyOperator(Operator.and) + .HighFrequencyOperator(Operator.Or) + .LowFrequencyOperator(Operator.And) .MinimumShouldMatch(2) .OnField(p=>p.Name) .Query("query") @@ -27,8 +27,8 @@ public void CommonTerms_Deserializes() q.Boost.Should().Be(1.1); q.CutoffFrequency.Should().Be(2.0); q.DisableCoord.Should().BeTrue(); - q.HighFrequencyOperator.Should().Be(Operator.or); - q.LowFrequencyOperator.Should().Be(Operator.and); + q.HighFrequencyOperator.Should().Be(Operator.Or); + q.LowFrequencyOperator.Should().Be(Operator.And); q.MinimumShouldMatch.Should().Be("2"); q.Field.Should().Be("name"); q.Query.Should().Be("query"); diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/CustomFiltersScoreQueryTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/CustomFiltersScoreQueryTests.cs index 704628d084a..b88bfa00a75 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/CustomFiltersScoreQueryTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/CustomFiltersScoreQueryTests.cs @@ -17,7 +17,7 @@ public void CustomFiltersScore_Deserializes() .Language("as") .MaxBoost("maxboost") .Query(qq=>Query1) - .ScoreMode(ScoreMode.avg) + .ScoreMode(ScoreMode.Average) .Filters(ff=>ff .Filter(sf=>Filter1) .Boost(2.3) @@ -29,7 +29,7 @@ public void CustomFiltersScore_Deserializes() ); q.Lang.Should().Be("as"); q.MaxBoost.Should().Be("maxboost"); - q.ScoreMode.Should().Be(ScoreMode.avg); + q.ScoreMode.Should().Be(ScoreMode.Average); AssertIsTermQuery(q.Query, Query1); diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/FuzzyQueryTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/FuzzyQueryTests.cs index f28c47fe9a9..b9d977b6e16 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/FuzzyQueryTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/FuzzyQueryTests.cs @@ -19,7 +19,7 @@ public void Fuzzy_Deserializes() .MaxExpansions(4) .OnField(p=>p.Name) .PrefixLength(3) - .Rewrite(RewriteMultiTerm.constant_score_filter) + .Rewrite(RewriteMultiTerm.ConstantScoreFilter) .Value("findme") ) ); @@ -28,7 +28,7 @@ public void Fuzzy_Deserializes() q.Fuzziness.Should().Be("2.1"); q.MaxExpansions.Should().Be(4); q.Field.Should().Be("name"); - q.Rewrite.Should().Be(RewriteMultiTerm.constant_score_filter); + q.Rewrite.Should().Be(RewriteMultiTerm.ConstantScoreFilter); var stringFuzzy = (IStringFuzzyQuery) q; stringFuzzy.PrefixLength.Should().Be(3); diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/MatchQueryTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/MatchQueryTests.cs index 18ad0ca6960..c98369b8944 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/MatchQueryTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/MatchQueryTests.cs @@ -19,10 +19,10 @@ public void Match_Deserializes() .Fuzziness(2.3) .Lenient() .MaxExpansions(2) - .Operator(Operator.and) + .Operator(Operator.And) .PrefixLength(2) .Query("querytext") - .Rewrite(RewriteMultiTerm.constant_score_boolean) + .Rewrite(RewriteMultiTerm.ConstantScoreBoolean) .Slop(2) ) ); @@ -35,10 +35,10 @@ public void Match_Deserializes() q.Lenient.Should().BeTrue(); q.MaxExpansions.Should().Be(2); q.Field.Should().Be("name"); - q.Operator.Should().Be(Operator.and); + q.Operator.Should().Be(Operator.And); q.PrefixLength.Should().Be(2); q.Query.Should().Be("querytext"); - q.Rewrite.Should().Be(RewriteMultiTerm.constant_score_boolean); + q.Rewrite.Should().Be(RewriteMultiTerm.ConstantScoreBoolean); q.Slop.Should().Be(2); } @@ -55,10 +55,10 @@ public void MatchPhrasePhrefix_Deserializes() .Fuzziness(2.3) .Lenient() .MaxExpansions(2) - .Operator(Operator.and) + .Operator(Operator.And) .PrefixLength(2) .Query("querytext") - .Rewrite(RewriteMultiTerm.constant_score_boolean) + .Rewrite(RewriteMultiTerm.ConstantScoreBoolean) .Slop(2) ) ); @@ -70,10 +70,10 @@ public void MatchPhrasePhrefix_Deserializes() q.Lenient.Should().BeTrue(); q.MaxExpansions.Should().Be(2); q.Field.Should().Be("name"); - q.Operator.Should().Be(Operator.and); + q.Operator.Should().Be(Operator.And); q.PrefixLength.Should().Be(2); q.Query.Should().Be("querytext"); - q.Rewrite.Should().Be(RewriteMultiTerm.constant_score_boolean); + q.Rewrite.Should().Be(RewriteMultiTerm.ConstantScoreBoolean); q.Slop.Should().Be(2); } @@ -90,10 +90,10 @@ public void MatchPhrase_Deserializes() .Fuzziness(2.3) .Lenient() .MaxExpansions(2) - .Operator(Operator.and) + .Operator(Operator.And) .PrefixLength(2) .Query("querytext") - .Rewrite(RewriteMultiTerm.constant_score_boolean) + .Rewrite(RewriteMultiTerm.ConstantScoreBoolean) .Slop(2) ) ); @@ -105,10 +105,10 @@ public void MatchPhrase_Deserializes() q.Lenient.Should().BeTrue(); q.MaxExpansions.Should().Be(2); q.Field.Should().Be("name"); - q.Operator.Should().Be(Operator.and); + q.Operator.Should().Be(Operator.And); q.PrefixLength.Should().Be(2); q.Query.Should().Be("querytext"); - q.Rewrite.Should().Be(RewriteMultiTerm.constant_score_boolean); + q.Rewrite.Should().Be(RewriteMultiTerm.ConstantScoreBoolean); q.Slop.Should().Be(2); } diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/MultiMatchQueryTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/MultiMatchQueryTests.cs index deb67fbec0c..101534078d4 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/MultiMatchQueryTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/MultiMatchQueryTests.cs @@ -18,13 +18,13 @@ public void MultiMatch_Deserializes() .Fuzziness(0.8) .MaxExpansions(2) .OnFields(p=>p.Name,p=>p.MyGeoShape) - .Operator(Operator.or) + .Operator(Operator.Or) .PrefixLength(2) .Query("querytext") - .Rewrite(RewriteMultiTerm.top_terms_N) + .Rewrite(RewriteMultiTerm.TopTermsN) .Slop(2) .TieBreaker(2.0) - .Type(TextQueryType.BEST_FIELDS) + .Type(TextQueryType.BestFields) ) ); q.Analyzer.Should().Be("my-analyzer"); @@ -33,13 +33,13 @@ public void MultiMatch_Deserializes() q.Fuzziness.Should().Be(0.8); q.MaxExpansions.Should().Be(2); q.Fields.Should().BeEquivalentTo(new [] { "name", "myGeoShape"}); - q.Operator.Should().Be(Operator.or); + q.Operator.Should().Be(Operator.Or); q.PrefixLength.Should().Be(2); q.Query.Should().Be("querytext"); - q.Rewrite.Should().Be(RewriteMultiTerm.top_terms_N); + q.Rewrite.Should().Be(RewriteMultiTerm.TopTermsN); q.Slop.Should().Be(2); q.TieBreaker.Should().Be(2.0); - q.Type.Should().Be(TextQueryType.BEST_FIELDS); + q.Type.Should().Be(TextQueryType.BestFields); } } } \ No newline at end of file diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/NestedQueryTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/NestedQueryTests.cs index d23991ad667..29ead0215e3 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/NestedQueryTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/NestedQueryTests.cs @@ -15,10 +15,10 @@ public void Nested_Deserializes() .Path(p=>p.NestedFollowers) .Query(qq=>Query1) .Scope("scopey") - .Score(NestedScore.max) + .Score(NestedScore.Max) ) ); - q.Score.Should().Be(NestedScore.max); + q.Score.Should().Be(NestedScore.Max); q.Scope.Should().Be("scopey"); q.Path.Should().Be("nestedFollowers"); AssertIsTermQuery(q.Query, Query1); diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/PrefixQueryTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/PrefixQueryTests.cs index a68f072d71d..af9e0b15883 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/PrefixQueryTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/PrefixQueryTests.cs @@ -14,13 +14,13 @@ public void Prefix_Deserializes() f=>f.Prefix(pq=>pq .Boost(2.1) .OnField(p=>p.Name) - .Rewrite(RewriteMultiTerm.constant_score_boolean) + .Rewrite(RewriteMultiTerm.ConstantScoreBoolean) .Value("prefix*") ) ); q.Boost.Should().Be(2.1); q.Field.Should().Be("name"); - q.Rewrite.Should().Be(RewriteMultiTerm.constant_score_boolean); + q.Rewrite.Should().Be(RewriteMultiTerm.ConstantScoreBoolean); q.Value.Should().Be("prefix*"); } } diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/QueryStringQueryTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/QueryStringQueryTests.cs index 916fd0c6d7b..9a7e5f9babf 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/QueryStringQueryTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/QueryStringQueryTests.cs @@ -17,7 +17,7 @@ public void QueryString_Deserializes() .Analyzer("my-analyzer") .AutoGeneratePhraseQueries() .Boost(1.1) - .DefaultOperator(Operator.and) + .DefaultOperator(Operator.And) .EnablePositionIncrements() .FuzzyMinimumSimilarity(2.1) .FuzzyPrefixLength(2) @@ -28,7 +28,7 @@ public void QueryString_Deserializes() .OnFields(p=>p.Name, p=>p.Origin) .PhraseSlop(2.1) .Query("q") - .Rewrite(RewriteMultiTerm.constant_score_default) + .Rewrite(RewriteMultiTerm.ConstantScoreDefault) .TieBreaker(4.1) .UseDisMax() ) @@ -38,7 +38,7 @@ public void QueryString_Deserializes() q.Analyzer.Should().Be("my-analyzer"); q.AutoGeneratePhraseQueries.Should().BeTrue(); q.Boost.Should().Be(1.1); - q.DefaultOperator.Should().Be(Operator.and); + q.DefaultOperator.Should().Be(Operator.And); q.EnablePositionIncrements.Should().BeTrue(); q.FuzzyMinimumSimilarity.Should().Be(2.1); q.FuzzyPrefixLength.Should().Be(2); @@ -49,7 +49,7 @@ public void QueryString_Deserializes() q.Fields.Should().BeEquivalentTo(new []{"name", "origin"}); q.PhraseSlop.Should().Be(2.1); q.Query.Should().Be("q"); - q.Rewrite.Should().Be(RewriteMultiTerm.constant_score_default); + q.Rewrite.Should().Be(RewriteMultiTerm.ConstantScoreDefault); q.TieBreaker.Should().Be(4.1); q.UseDismax.Should().BeTrue(); } diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/SimpleQueryStringQueryTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/SimpleQueryStringQueryTests.cs index 5c7b3298695..4242f161cca 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/SimpleQueryStringQueryTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/SimpleQueryStringQueryTests.cs @@ -13,7 +13,7 @@ public void SimpleQueryString_Deserializes() f=>f.SimpleQueryString, f=>f.SimpleQueryString(sq=>sq .Analyzer("my-analyzer") - .DefaultOperator(Operator.and) + .DefaultOperator(Operator.And) .Flags("ASFAS") .Locale("en") .LowercaseExpendedTerms() @@ -23,7 +23,7 @@ public void SimpleQueryString_Deserializes() ) ); q.Analyzer.Should().Be("my-analyzer"); - q.DefaultOperator.Should().Be(Operator.and); + q.DefaultOperator.Should().Be(Operator.And); q.Flags.Should().Be("ASFAS"); q.Locale.Should().Be("en"); q.LowercaseExpendedTerms.Should().BeTrue(); diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/WildCardQueryTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/WildCardQueryTests.cs index 787da24d738..3eee8a3ca96 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/WildCardQueryTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/WildCardQueryTests.cs @@ -15,7 +15,7 @@ public void WildCard_Deserializes() f => f.Wildcard, f => f.Wildcard(wq => wq .Boost(1.1) - .Rewrite(RewriteMultiTerm.constant_score_boolean) + .Rewrite(RewriteMultiTerm.ConstantScoreBoolean) .OnField(p => p.Name) .Value("wild*") ) @@ -23,7 +23,7 @@ public void WildCard_Deserializes() q.Boost.Should().Be(1.1); q.Field.Should().Be("name"); q.Value.Should().Be("wild*"); - q.Rewrite.Should().Be(RewriteMultiTerm.constant_score_boolean); + q.Rewrite.Should().Be(RewriteMultiTerm.ConstantScoreBoolean); } [Test] @@ -33,7 +33,7 @@ public void InitializerTests() { Field = "my_prefix_field", Value = "value", - Rewrite = RewriteMultiTerm.constant_score_boolean + Rewrite = RewriteMultiTerm.ConstantScoreBoolean }; var searchRequest = new SearchRequest() { @@ -54,7 +54,7 @@ public void InitializerTypedTests() new WildcardQuery(p => p.Name) { Value = "value", - Rewrite = RewriteMultiTerm.constant_score_boolean + Rewrite = RewriteMultiTerm.ConstantScoreBoolean } && new WildcardQuery { diff --git a/src/Tests/Nest.Tests.Unit/Search/Facets/GeoDistanceFacetJson.cs b/src/Tests/Nest.Tests.Unit/Search/Facets/GeoDistanceFacetJson.cs index 3039a6664b8..186e359e105 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Facets/GeoDistanceFacetJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Facets/GeoDistanceFacetJson.cs @@ -81,7 +81,7 @@ public void GeoDistanceUsingHashAndOptions() .OnField(f => f.Origin) .OnValueField(f => f.Origin) .PinTo("drm3btev3e86") - .Unit(GeoUnit.mi) + .Unit(GeoUnit.Miles) .DistanceType(GeoDistance.arc) ); var json = TestElasticClient.Serialize(s); @@ -111,7 +111,7 @@ public void GeoDistanceScript() .OnValueScript("doc['num1'].value * factor") .Params(p=>p.Add("factor", 5)) .PinTo(40, -70) - .Unit(GeoUnit.mi) + .Unit(GeoUnit.Miles) .DistanceType(GeoDistance.arc) ); var json = TestElasticClient.Serialize(s); diff --git a/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoDistanceFilterJson.cs b/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoDistanceFilterJson.cs index aa82dd1ecc7..86af4b5f526 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoDistanceFilterJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoDistanceFilterJson.cs @@ -17,7 +17,7 @@ public void GeoDistanceFilter() .Name("my_geo_filter") .GeoDistance(f=>f.Origin, d=>d .Location(Lat: 40, Lon: -70) - .Distance(12, GeoUnit.km) + .Distance(12, GeoUnit.Kilometers) .Optimize(GeoOptimizeBBox.memory) ) ); diff --git a/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoDistanceRangeFilterJson.cs b/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoDistanceRangeFilterJson.cs index 2bd7b73727d..4341afa22c3 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoDistanceRangeFilterJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoDistanceRangeFilterJson.cs @@ -17,7 +17,7 @@ public void GeoDistanceRangeFilter() .Name("my_geo_filter") .GeoDistanceRange(f=>f.Origin, d=>d .Location(Lat: 40, Lon: -70) - .Distance(From: 12, To: 200, Unit: GeoUnit.km) + .Distance(From: 12, To: 200, Unit: GeoUnit.Kilometers) .Optimize(GeoOptimizeBBox.memory) ) ); diff --git a/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/TermsFilterJson.cs b/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/TermsFilterJson.cs index 81321f9584c..049547aebee 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/TermsFilterJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/TermsFilterJson.cs @@ -34,7 +34,7 @@ public void TermsFilterWithCache() .Size(10) .Filter(ff => ff .Cache(false).Name("terms_filter") - .Terms(f => f.Name, new [] {"elasticsearch.pm"}, Execution:TermsExecution.@bool) + .Terms(f => f.Name, new [] {"elasticsearch.pm"}, Execution:TermsExecution.Bool) ); var json = TestElasticClient.Serialize(s); diff --git a/src/Tests/Nest.Tests.Unit/Search/InitializerSyntax/InitializerExample.cs b/src/Tests/Nest.Tests.Unit/Search/InitializerSyntax/InitializerExample.cs index 81731ba9e08..94ee3b91006 100644 --- a/src/Tests/Nest.Tests.Unit/Search/InitializerSyntax/InitializerExample.cs +++ b/src/Tests/Nest.Tests.Unit/Search/InitializerSyntax/InitializerExample.cs @@ -27,7 +27,7 @@ public void FullExample_InitializerSyntax_Search() { Field = "prefix_field", Value = "prefi", - Rewrite = RewriteMultiTerm.constant_score_boolean + Rewrite = RewriteMultiTerm.ConstantScoreBoolean }; var result = _client.Search(new SearchRequest diff --git a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/CommonTerms/CommonTermsTests.cs b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/CommonTerms/CommonTermsTests.cs index 720abcd116d..fdb729bcf20 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/CommonTerms/CommonTermsTests.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/CommonTerms/CommonTermsTests.cs @@ -20,8 +20,8 @@ public void CommonTermsFull() .Boost(1.2) .CutOffFrequency(0.01) .DisableCoord(false) - .HighFrequencyOperator(Operator.and) - .LowFrequencyOperator(Operator.or) + .HighFrequencyOperator(Operator.And) + .LowFrequencyOperator(Operator.Or) .MinimumShouldMatch(1) .Query("This is the most awful stopwords query ever") ) diff --git a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/MatchQueryJson.cs b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/MatchQueryJson.cs index e18a8054c69..cab988c6b53 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/MatchQueryJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/MatchQueryJson.cs @@ -16,7 +16,7 @@ public void MatchQuery() .Match(t=>t .OnField(f=>f.Name) .Query("this is a test") - .Rewrite(RewriteMultiTerm.constant_score_default) + .Rewrite(RewriteMultiTerm.ConstantScoreDefault) ) ); @@ -39,7 +39,7 @@ public void MatchQuery() .Match(t=>t .OnField(f=>f.Name) .Query("this is a test") - .Rewrite(RewriteMultiTerm.constant_score_default) + .Rewrite(RewriteMultiTerm.ConstantScoreDefault) ) ); @@ -89,7 +89,7 @@ public void MatchQuerySomeOptions() .Fuzziness(1.0) .Analyzer("my_analyzer") .CutoffFrequency(0.3) - .Rewrite(RewriteMultiTerm.constant_score_filter) + .Rewrite(RewriteMultiTerm.ConstantScoreFilter) .PrefixLength(2) ) ); diff --git a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/PrefixQueryJson.cs b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/PrefixQueryJson.cs index 392f49f6b2a..566594582be 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/PrefixQueryJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/PrefixQueryJson.cs @@ -41,7 +41,7 @@ public void TestPrefixWithBoostRewriteQuery() .From(0) .Size(10) .Query(q => q - .Prefix(f => f.Name, "el", 1.2, RewriteMultiTerm.constant_score_default) + .Prefix(f => f.Name, "el", 1.2, RewriteMultiTerm.ConstantScoreDefault) ); var json = TestElasticClient.Serialize(s); var expected = @"{ from: 0, size: 10, query : diff --git a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/QueryStringQueryJson.cs b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/QueryStringQueryJson.cs index d746c80a9e5..f254794119f 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/QueryStringQueryJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/QueryStringQueryJson.cs @@ -43,7 +43,7 @@ public void QueryStringQueryWithAllOptions() .QueryString(qs => qs .DefaultField(f=>f.Name) .Query("this that thus") - .DefaultOperator(Operator.and) + .DefaultOperator(Operator.And) .Analyzer("my_analyzer") .AllowLeadingWildcard(true) .LowercaseExpendedTerms(true) @@ -57,7 +57,7 @@ public void QueryStringQueryWithAllOptions() .MinimumShouldMatchPercentage(20) .UseDisMax(true) .TieBreaker(0.7) - .Rewrite(RewriteMultiTerm.top_terms_N) + .Rewrite(RewriteMultiTerm.TopTermsN) ) ); diff --git a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/SimpleQueryString/SimpleQueryStringQueryJson.cs b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/SimpleQueryString/SimpleQueryStringQueryJson.cs index 1f54b07e014..06ef5a3adc3 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/SimpleQueryString/SimpleQueryStringQueryJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/SimpleQueryString/SimpleQueryStringQueryJson.cs @@ -21,7 +21,7 @@ public void SimpleQueryStringFull() .Add(f=>f.Country, 5.0) ) .Flags("ALL") - .DefaultOperator(Operator.and) + .DefaultOperator(Operator.And) .LowercaseExpendedTerms(true) .Locale("ROOT") ) diff --git a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/TopChildrenQueryJson.cs b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/TopChildrenQueryJson.cs index b4a7b30bb38..f7401abd03f 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/TopChildrenQueryJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/TopChildrenQueryJson.cs @@ -43,7 +43,7 @@ public void HasChildOverrideTypeQuery() .Query(q => q .TopChildren(fz => fz .Query(qq => qq.Term(f => f.FirstName, "john")) - .Score(TopChildrenScore.avg) + .Score(TopChildrenScore.Average) .Scope("my_scope") .Type("sillypeople") ) diff --git a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/WildcardQueryJson.cs b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/WildcardQueryJson.cs index db0cc4c8ca7..18ffcd89b05 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/WildcardQueryJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/WildcardQueryJson.cs @@ -41,7 +41,7 @@ public void TestWildcardWithBoostRewriteQuery() .From(0) .Size(10) .Query(q => q - .Wildcard(f => f.Name, "elasticsearch.*", Boost: 1.2, Rewrite: RewriteMultiTerm.scoring_boolean) + .Wildcard(f => f.Name, "elasticsearch.*", Boost: 1.2, Rewrite: RewriteMultiTerm.ScoringBoolean) ); var json = TestElasticClient.Serialize(s); var expected = @"{ from: 0, size: 10, query : diff --git a/src/Tests/Nest.Tests.Unit/Search/Sorting/SortTests.cs b/src/Tests/Nest.Tests.Unit/Search/Sorting/SortTests.cs index 326e19bfd6b..b2a22b34244 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Sorting/SortTests.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Sorting/SortTests.cs @@ -174,7 +174,7 @@ public void TestSortGeo() .MissingLast() .Descending() .PinTo(40, -70) - .Unit(GeoUnit.km) + .Unit(GeoUnit.Kilometers) ); var json = TestElasticClient.Serialize(s); var expected = @" From dfecbc8ec8f56ab3a6e619afb46a96929765412f Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 25 Jun 2014 17:11:41 +0200 Subject: [PATCH 3/8] added string enum converter --- src/Nest/DSL/Facets/DateInterval.cs | 3 + src/Nest/DSL/Facets/DateRounding.cs | 59 +++++++++-------- src/Nest/DSL/Facets/TermsOrder.cs | 3 + src/Nest/DSL/Facets/TermsStatsOrder.cs | 66 +++++++++++-------- .../Functions/FieldValueFactorModifier.cs | 3 + .../DSL/Query/Functions/FunctionBoostMode.cs | 3 + .../DSL/Query/Functions/FunctionScoreMode.cs | 3 + src/Nest/Domain/DSL/ChildScoreType.cs | 3 + src/Nest/Domain/DSL/ParentScoreType.cs | 3 + src/Nest/Enums/DynamicMappingOption.cs | 3 + src/Nest/Enums/FieldIndexOption.cs | 3 + src/Nest/Enums/FieldType.cs | 3 + 12 files changed, 101 insertions(+), 54 deletions(-) diff --git a/src/Nest/DSL/Facets/DateInterval.cs b/src/Nest/DSL/Facets/DateInterval.cs index 6c196d61bfe..119b7b55c3c 100644 --- a/src/Nest/DSL/Facets/DateInterval.cs +++ b/src/Nest/DSL/Facets/DateInterval.cs @@ -3,9 +3,12 @@ using System.Linq; using System.Runtime.Serialization; using System.Text; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { + [JsonConverter(typeof(StringEnumConverter))] public enum DateInterval { [EnumMember(Value = "minute")] diff --git a/src/Nest/DSL/Facets/DateRounding.cs b/src/Nest/DSL/Facets/DateRounding.cs index 12a2f9bd01c..6cdb1d0c155 100644 --- a/src/Nest/DSL/Facets/DateRounding.cs +++ b/src/Nest/DSL/Facets/DateRounding.cs @@ -3,35 +3,38 @@ using System.Linq; using System.Runtime.Serialization; using System.Text; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { - public enum DateRounding - { - /// - /// (the default), rounds to the lowest whole unit of this field. - /// - [EnumMember(Value = "minute")] - Floor, - /// - /// Rounds to the highest whole unit of this field. - /// - [EnumMember(Value = "ceiling")] - Ceiling, - /// - /// Round to the nearest whole unit of this field. If the given millisecond value is closer to the floor or is exactly halfway, this function behaves like floor. If the millisecond value is closer to the ceiling, this function behaves like ceiling. - /// - [EnumMember(Value = "half_floor")] - HalfFloor, - /// - /// Round to the nearest whole unit of this field. If the given millisecond value is closer to the floor, this function behaves like floor. If the millisecond value is closer to the ceiling or is exactly halfway, this function behaves like ceiling. - /// - [EnumMember(Value = "half_ceiling")] - HalfCeiling, - /// - /// Round to the nearest whole unit of this field. If the given millisecond value is closer to the floor, this function behaves like floor. If the millisecond value is closer to the ceiling, this function behaves like ceiling. If the millisecond value is exactly halfway between the floor and ceiling, the ceiling is chosen over the floor only if it makes this field’s value even. - /// - [EnumMember(Value = "half_even")] - HalfEven - } + [JsonConverter(typeof(StringEnumConverter))] + public enum DateRounding + { + /// + /// (the default), rounds to the lowest whole unit of this field. + /// + [EnumMember(Value = "minute")] + Floor, + /// + /// Rounds to the highest whole unit of this field. + /// + [EnumMember(Value = "ceiling")] + Ceiling, + /// + /// Round to the nearest whole unit of this field. If the given millisecond value is closer to the floor or is exactly halfway, this function behaves like floor. If the millisecond value is closer to the ceiling, this function behaves like ceiling. + /// + [EnumMember(Value = "half_floor")] + HalfFloor, + /// + /// Round to the nearest whole unit of this field. If the given millisecond value is closer to the floor, this function behaves like floor. If the millisecond value is closer to the ceiling or is exactly halfway, this function behaves like ceiling. + /// + [EnumMember(Value = "half_ceiling")] + HalfCeiling, + /// + /// Round to the nearest whole unit of this field. If the given millisecond value is closer to the floor, this function behaves like floor. If the millisecond value is closer to the ceiling, this function behaves like ceiling. If the millisecond value is exactly halfway between the floor and ceiling, the ceiling is chosen over the floor only if it makes this field’s value even. + /// + [EnumMember(Value = "half_even")] + HalfEven + } } diff --git a/src/Nest/DSL/Facets/TermsOrder.cs b/src/Nest/DSL/Facets/TermsOrder.cs index 53bdf04daff..2b1e44e183a 100644 --- a/src/Nest/DSL/Facets/TermsOrder.cs +++ b/src/Nest/DSL/Facets/TermsOrder.cs @@ -3,9 +3,12 @@ using System.Linq; using System.Runtime.Serialization; using System.Text; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { + [JsonConverter(typeof(StringEnumConverter))] public enum TermsOrder { [EnumMember(Value = "count")] diff --git a/src/Nest/DSL/Facets/TermsStatsOrder.cs b/src/Nest/DSL/Facets/TermsStatsOrder.cs index 536c18123e9..3a2d5ee4769 100644 --- a/src/Nest/DSL/Facets/TermsStatsOrder.cs +++ b/src/Nest/DSL/Facets/TermsStatsOrder.cs @@ -1,26 +1,40 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using System.Linq.Expressions; - -namespace Nest -{ - public enum TermsStatsOrder - { - term = 0, - reverse_term, - count, - reverse_count, - total, - reverse_total, - min, - reverse_min, - max, - reverse_max, - mean, - reverse_mean - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.Linq.Expressions; + +namespace Nest +{ + [JsonConverter(typeof(StringEnumConverter))] + public enum TermsStatsOrder + { + [EnumMember(Value = "term")] + Term = 0, + [EnumMember(Value = "reverse_term")] + ReverseTerm, + [EnumMember(Value = "count")] + Count, + [EnumMember(Value = "reverse_count")] + ReverseCount, + [EnumMember(Value = "total")] + Total, + [EnumMember(Value = "reverse_total")] + ReverseTotal, + [EnumMember(Value = "min")] + Min, + [EnumMember(Value = "reverse_min")] + ReverseMin, + [EnumMember(Value = "max")] + Max, + [EnumMember(Value = "reverse_max")] + ReverseMax, + [EnumMember(Value = "mean")] + Mean, + [EnumMember(Value = "reverse_mean")] + ReverseMean + } +} diff --git a/src/Nest/DSL/Query/Functions/FieldValueFactorModifier.cs b/src/Nest/DSL/Query/Functions/FieldValueFactorModifier.cs index 002bc56e8cb..74a372d47e2 100644 --- a/src/Nest/DSL/Query/Functions/FieldValueFactorModifier.cs +++ b/src/Nest/DSL/Query/Functions/FieldValueFactorModifier.cs @@ -1,7 +1,10 @@ using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { + [JsonConverter(typeof(StringEnumConverter))] public enum FieldValueFactorModifier { [EnumMember(Value = "none")] diff --git a/src/Nest/DSL/Query/Functions/FunctionBoostMode.cs b/src/Nest/DSL/Query/Functions/FunctionBoostMode.cs index 3802548a903..58182a2c52a 100644 --- a/src/Nest/DSL/Query/Functions/FunctionBoostMode.cs +++ b/src/Nest/DSL/Query/Functions/FunctionBoostMode.cs @@ -1,7 +1,10 @@ using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { + [JsonConverter(typeof(StringEnumConverter))] public enum FunctionBoostMode { [EnumMember(Value = "multiply")] diff --git a/src/Nest/DSL/Query/Functions/FunctionScoreMode.cs b/src/Nest/DSL/Query/Functions/FunctionScoreMode.cs index e2e907bc284..b9e4dda4920 100644 --- a/src/Nest/DSL/Query/Functions/FunctionScoreMode.cs +++ b/src/Nest/DSL/Query/Functions/FunctionScoreMode.cs @@ -1,7 +1,10 @@ using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { + [JsonConverter(typeof(StringEnumConverter))] public enum FunctionScoreMode { [EnumMember(Value = "multiply")] diff --git a/src/Nest/Domain/DSL/ChildScoreType.cs b/src/Nest/Domain/DSL/ChildScoreType.cs index 4c6b8de92ea..8188b9fe912 100644 --- a/src/Nest/Domain/DSL/ChildScoreType.cs +++ b/src/Nest/Domain/DSL/ChildScoreType.cs @@ -3,9 +3,12 @@ using System.Linq; using System.Runtime.Serialization; using System.Text; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { + [JsonConverter(typeof(StringEnumConverter))] public enum ChildScoreType { [EnumMember(Value = "none")] diff --git a/src/Nest/Domain/DSL/ParentScoreType.cs b/src/Nest/Domain/DSL/ParentScoreType.cs index c11a3e61205..dc31e09f659 100644 --- a/src/Nest/Domain/DSL/ParentScoreType.cs +++ b/src/Nest/Domain/DSL/ParentScoreType.cs @@ -3,9 +3,12 @@ using System.Linq; using System.Runtime.Serialization; using System.Text; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { + [JsonConverter(typeof(StringEnumConverter))] public enum ParentScoreType { [EnumMember(Value = "none")] diff --git a/src/Nest/Enums/DynamicMappingOption.cs b/src/Nest/Enums/DynamicMappingOption.cs index 8ce2dc78a09..68b7a7f8cdb 100644 --- a/src/Nest/Enums/DynamicMappingOption.cs +++ b/src/Nest/Enums/DynamicMappingOption.cs @@ -1,10 +1,13 @@ using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { /// /// Controls how elasticsearch handles dynamic mapping changes when a new document present new fields /// + [JsonConverter(typeof(StringEnumConverter))] public enum DynamicMappingOption { /// diff --git a/src/Nest/Enums/FieldIndexOption.cs b/src/Nest/Enums/FieldIndexOption.cs index 921c19c64c4..22fdce6a246 100644 --- a/src/Nest/Enums/FieldIndexOption.cs +++ b/src/Nest/Enums/FieldIndexOption.cs @@ -1,7 +1,10 @@ using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { + [JsonConverter(typeof(StringEnumConverter))] public enum FieldIndexOption { [EnumMember(Value = "analyzed")] diff --git a/src/Nest/Enums/FieldType.cs b/src/Nest/Enums/FieldType.cs index fc80b9b52fc..79a3b98bb53 100644 --- a/src/Nest/Enums/FieldType.cs +++ b/src/Nest/Enums/FieldType.cs @@ -3,12 +3,15 @@ using System.Linq; using System.Runtime.Serialization; using System.Text; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { /// /// Define the type of field content. /// + [JsonConverter(typeof(StringEnumConverter))] public enum FieldType { /// From 3272309cdc43ed6d05212ab11fbbda2cb9cb1382 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 25 Jun 2014 17:27:28 +0200 Subject: [PATCH 4/8] fixed post merge build errors --- src/Nest/Nest.csproj | 2 +- .../Aggregations/BucketAggregationTests.cs | 2 +- .../Core/Map/Properties/PropertiesTests.cs | 22 ++++++++-------- .../MapRootObjectPropertiesTests.cs | 16 ++++++------ .../Facet/TermFacetResponseTests.cs | 2 +- .../Indices/IndicesTests.cs | 6 ++--- .../IntegrationSetup.cs | 8 +++--- .../Mapping/MapTests.cs | 2 +- .../Mapping/NotAnalyzedTest.cs | 4 +-- .../Reproduce/Reproduce325Tests.cs | 4 +-- .../Domain/ElasticsearchProject.cs | 8 +++--- .../Nest.Tests.MockData/Domain/Person.cs | 4 +-- .../DynamicTemplates/DynamicTemplatesTests.cs | 2 +- .../Core/Map/FluentMappingFullExampleTests.cs | 14 +++++----- .../Core/Map/MappingBehaviourTests.cs | 4 +-- .../Core/Map/Properties/PropertiesTests.cs | 26 +++++++++---------- .../Filter/GeoBoundingBoxFilterTests.cs | 10 +++---- .../Filter/GeoDistanceFilterTests.cs | 4 +-- .../Filter/GeoDistanceRangeFilterTests.cs | 12 ++++----- .../Queries/FunctionScoreQueryTests.cs | 4 +-- .../Search/Facets/GeoDistanceFacetJson.cs | 4 +-- .../Search/Facets/TermsFacetJson.cs | 8 +++--- .../Search/Facets/TermsStatsFacetJson.cs | 2 +- .../Singles/GeoBoundingBoxFilterJson.cs | 2 +- .../Filter/Singles/GeoDistanceFilterJson.cs | 2 +- .../Singles/GeoDistanceRangeFilterJson.cs | 2 +- .../InitializerSyntax/InitializerExample.cs | 2 +- .../Query/Singles/FunctionScoreQueryJson.cs | 14 +++++----- 28 files changed, 96 insertions(+), 96 deletions(-) diff --git a/src/Nest/Nest.csproj b/src/Nest/Nest.csproj index cf95da55661..e2481d83e72 100644 --- a/src/Nest/Nest.csproj +++ b/src/Nest/Nest.csproj @@ -175,6 +175,7 @@ + @@ -328,7 +329,6 @@ - diff --git a/src/Tests/Nest.Tests.Integration/Aggregations/BucketAggregationTests.cs b/src/Tests/Nest.Tests.Integration/Aggregations/BucketAggregationTests.cs index f0a5f49f33e..9d94bfc2ad8 100644 --- a/src/Tests/Nest.Tests.Integration/Aggregations/BucketAggregationTests.cs +++ b/src/Tests/Nest.Tests.Integration/Aggregations/BucketAggregationTests.cs @@ -137,7 +137,7 @@ public void GeoHash() .Aggregations(a => a .GeoHash("bucket_agg", m => m .Field(p => p.Origin) - .GeoHashPrecision(GeoHashPrecision.precision_2) + .GeoHashPrecision(GeoHashPrecision.Precision2) ) ) ); diff --git a/src/Tests/Nest.Tests.Integration/Core/Map/Properties/PropertiesTests.cs b/src/Tests/Nest.Tests.Integration/Core/Map/Properties/PropertiesTests.cs index 168835d0f84..cbf548235c9 100644 --- a/src/Tests/Nest.Tests.Integration/Core/Map/Properties/PropertiesTests.cs +++ b/src/Tests/Nest.Tests.Integration/Core/Map/Properties/PropertiesTests.cs @@ -21,7 +21,7 @@ public void StringProperty() .Name(p => p.Name) .IndexName("my_crazy_name_i_want_in_lucene") .IncludeInAll() - .Index(FieldIndexOption.analyzed) + .Index(FieldIndexOption.Analyzed) .IndexAnalyzer("standard") .IndexOptions(IndexOptions.Positions) .NullValue("my_special_null_value") @@ -127,8 +127,8 @@ public void AttachmentProperty() .Properties(props => props .Attachment(s => s .Name(p => p.MyAttachment) - .FileField(fs => fs.Index(FieldIndexOption.not_analyzed).Store()) - .AuthorField(fs => fs.Index(FieldIndexOption.analyzed).Store(false)) + .FileField(fs => fs.Index(FieldIndexOption.NotAnalyzed).Store()) + .AuthorField(fs => fs.Index(FieldIndexOption.Analyzed).Store(false)) .DateField(fs => fs.Store(false).IncludeInAll()) ) ) @@ -148,7 +148,7 @@ public void ObjectProperty() .MapFromAttributes() .Path("full") .Properties(pprops => pprops - .String(ps => ps.Name(p => p.FirstName).Index(FieldIndexOption.not_analyzed)) + .String(ps => ps.Name(p => p.FirstName).Index(FieldIndexOption.NotAnalyzed)) //etcetera ) ) @@ -171,7 +171,7 @@ public void NestedObjectProperty() .MapFromAttributes() .Path("full") .Properties(pprops => pprops - .String(ps => ps.Name(p => p.FirstName).Index(FieldIndexOption.not_analyzed)) + .String(ps => ps.Name(p => p.FirstName).Index(FieldIndexOption.NotAnalyzed)) //etcetera ) ) @@ -187,8 +187,8 @@ public void MultiFieldProperty() .MultiField(s => s .Name(p => p.Name) .Fields(pprops => pprops - .String(ps => ps.Name(p => p.Name).Index(FieldIndexOption.not_analyzed)) - .String(ps => ps.Name(p => p.Name.Suffix("searchable")).Index(FieldIndexOption.analyzed)) + .String(ps => ps.Name(p => p.Name).Index(FieldIndexOption.NotAnalyzed)) + .String(ps => ps.Name(p => p.Name.Suffix("searchable")).Index(FieldIndexOption.Analyzed)) ) ) ) @@ -205,8 +205,8 @@ public void MultiFieldPropertyWithFullNamePath() .Path(MultiFieldMappingPath.Full) .Name(p => p.Name) .Fields(pprops => pprops - .String(ps => ps.Name(p => p.Name).Index(FieldIndexOption.not_analyzed)) - .String(ps => ps.Name(p => p.Name.Suffix("searchable")).Index(FieldIndexOption.analyzed)) + .String(ps => ps.Name(p => p.Name).Index(FieldIndexOption.NotAnalyzed)) + .String(ps => ps.Name(p => p.Name.Suffix("searchable")).Index(FieldIndexOption.Analyzed)) ) ) ) @@ -223,8 +223,8 @@ public void MultiFieldPropertyWithJustNamePath() .Path(MultiFieldMappingPath.JustName) .Name(p => p.Name) .Fields(pprops => pprops - .String(ps => ps.Name(p => p.Name).Index(FieldIndexOption.not_analyzed)) - .String(ps => ps.Name(p => p.Name.Suffix("searchable")).Index(FieldIndexOption.analyzed)) + .String(ps => ps.Name(p => p.Name).Index(FieldIndexOption.NotAnalyzed)) + .String(ps => ps.Name(p => p.Name.Suffix("searchable")).Index(FieldIndexOption.Analyzed)) ) ) ) diff --git a/src/Tests/Nest.Tests.Integration/Core/Map/RootProperties/MapRootObjectPropertiesTests.cs b/src/Tests/Nest.Tests.Integration/Core/Map/RootProperties/MapRootObjectPropertiesTests.cs index 3ff65a8eff0..bd5d5d4b4a1 100644 --- a/src/Tests/Nest.Tests.Integration/Core/Map/RootProperties/MapRootObjectPropertiesTests.cs +++ b/src/Tests/Nest.Tests.Integration/Core/Map/RootProperties/MapRootObjectPropertiesTests.cs @@ -36,11 +36,11 @@ public void DynamicAllowSetAndGet() var result = this._client.Map(m => m .Type("elasticsearchprojects_allow") .Indices(ElasticsearchConfiguration.DefaultIndex, ElasticsearchConfiguration.DefaultIndex) - .Dynamic(DynamicMappingOption.allow) + .Dynamic(DynamicMappingOption.Allow) ); this.DefaultResponseAssertations(result); var getResult = this._client.GetMapping(gm=>gm.Index(ElasticsearchConfiguration.DefaultIndex).Type("elasticsearchprojects_allow")); - Assert.AreEqual(getResult.Mapping.Dynamic, DynamicMappingOption.allow); + Assert.AreEqual(getResult.Mapping.Dynamic, DynamicMappingOption.Allow); result = this._client.Map(m => m .Type("elasticsearchprojects_allow2") @@ -49,7 +49,7 @@ public void DynamicAllowSetAndGet() ); this.DefaultResponseAssertations(result); getResult = this._client.GetMapping(gm=>gm.Index(ElasticsearchConfiguration.DefaultIndex).Type("elasticsearchprojects_allow")); - Assert.AreEqual(getResult.Mapping.Dynamic, DynamicMappingOption.allow); + Assert.AreEqual(getResult.Mapping.Dynamic, DynamicMappingOption.Allow); } @@ -59,11 +59,11 @@ public void DynamicIgnoreSetAndGet() var result = this._client.Map(m => m .Type("elasticsearchprojects_ignore") .Indices(ElasticsearchConfiguration.DefaultIndex, ElasticsearchConfiguration.DefaultIndex) - .Dynamic(DynamicMappingOption.ignore) + .Dynamic(DynamicMappingOption.Ignore) ); this.DefaultResponseAssertations(result); var getResult = this._client.GetMapping(gm=>gm.Index(ElasticsearchConfiguration.DefaultIndex).Type("elasticsearchprojects_ignore")); - Assert.AreEqual(getResult.Mapping.Dynamic, DynamicMappingOption.ignore); + Assert.AreEqual(getResult.Mapping.Dynamic, DynamicMappingOption.Ignore); result = this._client.Map(m => m .Type("elasticsearchprojects_ignore2") @@ -72,7 +72,7 @@ public void DynamicIgnoreSetAndGet() ); this.DefaultResponseAssertations(result); getResult = this._client.GetMapping(gm=>gm.Index(ElasticsearchConfiguration.DefaultIndex).Type("elasticsearchprojects_ignore2")); - Assert.AreEqual(getResult.Mapping.Dynamic, DynamicMappingOption.ignore); + Assert.AreEqual(getResult.Mapping.Dynamic, DynamicMappingOption.Ignore); } [Test] @@ -81,11 +81,11 @@ public void DynamicStrictSetAndGet() var result = this._client.Map(m => m .Type("elasticsearchprojects_strict") .Indices(ElasticsearchConfiguration.DefaultIndex, ElasticsearchConfiguration.DefaultIndex) - .Dynamic(DynamicMappingOption.strict) + .Dynamic(DynamicMappingOption.Strict) ); this.DefaultResponseAssertations(result); var getResult = this._client.GetMapping(gm=>gm.Index(ElasticsearchConfiguration.DefaultIndex).Type("elasticsearchprojects_strict")); - Assert.AreEqual(getResult.Mapping.Dynamic, DynamicMappingOption.strict); + Assert.AreEqual(getResult.Mapping.Dynamic, DynamicMappingOption.Strict); } } diff --git a/src/Tests/Nest.Tests.Integration/Facet/TermFacetResponseTests.cs b/src/Tests/Nest.Tests.Integration/Facet/TermFacetResponseTests.cs index 05ed884529f..69245bec4c8 100644 --- a/src/Tests/Nest.Tests.Integration/Facet/TermFacetResponseTests.cs +++ b/src/Tests/Nest.Tests.Integration/Facet/TermFacetResponseTests.cs @@ -107,7 +107,7 @@ public void TestWithDSL() { var results = this._client.Search(s => s .FacetTerm(t=>t - .Order(TermsOrder.count) + .Order(TermsOrder.Count) .OnField(p => p.Name) .Size(10) ) diff --git a/src/Tests/Nest.Tests.Integration/Indices/IndicesTests.cs b/src/Tests/Nest.Tests.Integration/Indices/IndicesTests.cs index 5bfd627cc01..1a0f81e9744 100644 --- a/src/Tests/Nest.Tests.Integration/Indices/IndicesTests.cs +++ b/src/Tests/Nest.Tests.Integration/Indices/IndicesTests.cs @@ -299,7 +299,7 @@ public void PutMapping() var mapping = this._client.GetMapping().Mapping; var property = new StringMapping { - Index = FieldIndexOption.not_analyzed + Index = FieldIndexOption.NotAnalyzed }; mapping.Properties.Add(fieldName, property); @@ -324,12 +324,12 @@ public void CreateIndexMultiFieldMap() var primaryField = new StringMapping() { - Index = FieldIndexOption.not_analyzed + Index = FieldIndexOption.NotAnalyzed }; var analyzedField = new StringMapping() { - Index = FieldIndexOption.analyzed + Index = FieldIndexOption.Analyzed }; property.Fields.Add("name", primaryField); diff --git a/src/Tests/Nest.Tests.Integration/IntegrationSetup.cs b/src/Tests/Nest.Tests.Integration/IntegrationSetup.cs index e97d7341df8..bff05232135 100644 --- a/src/Tests/Nest.Tests.Integration/IntegrationSetup.cs +++ b/src/Tests/Nest.Tests.Integration/IntegrationSetup.cs @@ -33,8 +33,8 @@ public static void Setup() .String(s => s.Name(ep => ep.Content).TermVector(TermVectorOption.WithPositionsOffsetsPayloads)))) .AddMapping(m => m.MapFromAttributes()) .AddMapping(m => m.Properties(pp=>pp - .String(sm => sm.Name(p => p.Name1).Index(FieldIndexOption.not_analyzed)) - .String(sm => sm.Name(p => p.Name2).Index(FieldIndexOption.not_analyzed)) + .String(sm => sm.Name(p => p.Name1).Index(FieldIndexOption.NotAnalyzed)) + .String(sm => sm.Name(p => p.Name2).Index(FieldIndexOption.NotAnalyzed)) )) ); @@ -47,8 +47,8 @@ public static void Setup() .String(s => s.Name(ep => ep.Content).TermVector(TermVectorOption.WithPositionsOffsetsPayloads)))) .AddMapping(m => m.MapFromAttributes()) .AddMapping(m => m.Properties(pp => pp - .String(sm => sm.Name(p => p.Name1).Index(FieldIndexOption.not_analyzed)) - .String(sm => sm.Name(p => p.Name2).Index(FieldIndexOption.not_analyzed)) + .String(sm => sm.Name(p => p.Name1).Index(FieldIndexOption.NotAnalyzed)) + .String(sm => sm.Name(p => p.Name2).Index(FieldIndexOption.NotAnalyzed)) )) ); diff --git a/src/Tests/Nest.Tests.Integration/Mapping/MapTests.cs b/src/Tests/Nest.Tests.Integration/Mapping/MapTests.cs index 6d074887cbf..5bcc865ec56 100644 --- a/src/Tests/Nest.Tests.Integration/Mapping/MapTests.cs +++ b/src/Tests/Nest.Tests.Integration/Mapping/MapTests.cs @@ -26,7 +26,7 @@ private void TestMapping(RootObjectMapping typeMapping) Assert.AreEqual("integer", typeMapping.Properties["loc"].Type.Name); var mapping = typeMapping.Properties["country"] as StringMapping; Assert.NotNull(mapping); - Assert.AreEqual(FieldIndexOption.not_analyzed, mapping.Index); + Assert.AreEqual(FieldIndexOption.NotAnalyzed, mapping.Index); //Assert.AreEqual("elasticsearchprojects", typeMapping.Parent.Type); Assert.AreEqual("geo_point", typeMapping.Properties["origin"].Type.Name); diff --git a/src/Tests/Nest.Tests.Integration/Mapping/NotAnalyzedTest.cs b/src/Tests/Nest.Tests.Integration/Mapping/NotAnalyzedTest.cs index 62ced6fa771..c7faf6cd1f3 100644 --- a/src/Tests/Nest.Tests.Integration/Mapping/NotAnalyzedTest.cs +++ b/src/Tests/Nest.Tests.Integration/Mapping/NotAnalyzedTest.cs @@ -21,7 +21,7 @@ public void NotAnalyzedReturnsOneItem() var typeMapping = typeMappingResponse.Mapping; var mapping = typeMapping.Properties["country"] as StringMapping; Assert.NotNull(mapping); - Assert.AreEqual(FieldIndexOption.not_analyzed, mapping.Index); + Assert.AreEqual(FieldIndexOption.NotAnalyzed, mapping.Index); var indexResult = this._client.Index(new ElasticsearchProject { @@ -47,7 +47,7 @@ public void AnalyzedReturnsMoreItems() .AddMapping(m => m .MapFromAttributes() .Properties(pp=>pp - .String(pps=>pps.Name(p=>p.Country).Index(FieldIndexOption.analyzed)) + .String(pps=>pps.Name(p=>p.Country).Index(FieldIndexOption.Analyzed)) ) ) ); diff --git a/src/Tests/Nest.Tests.Integration/Reproduce/Reproduce325Tests.cs b/src/Tests/Nest.Tests.Integration/Reproduce/Reproduce325Tests.cs index 0054bacaa4b..a8a41962802 100644 --- a/src/Tests/Nest.Tests.Integration/Reproduce/Reproduce325Tests.cs +++ b/src/Tests/Nest.Tests.Integration/Reproduce/Reproduce325Tests.cs @@ -63,13 +63,13 @@ private static PutMappingDescriptor MapTechnicalProduct(PutMap .Properties(o => o .String(i => i .Name(x => x.Name) - .Index(FieldIndexOption.analyzed) + .Index(FieldIndexOption.Analyzed) .IndexAnalyzer("autocomplete") .SearchAnalyzer("standard") ) .String(i => i .Name(x => x.Brand) - .Index(FieldIndexOption.analyzed) + .Index(FieldIndexOption.Analyzed) .IndexAnalyzer("autocomplete") .SearchAnalyzer("standard") ) diff --git a/src/Tests/Nest.Tests.MockData/Domain/ElasticsearchProject.cs b/src/Tests/Nest.Tests.MockData/Domain/ElasticsearchProject.cs index 668415b8c7c..ee167e95192 100644 --- a/src/Tests/Nest.Tests.MockData/Domain/ElasticsearchProject.cs +++ b/src/Tests/Nest.Tests.MockData/Domain/ElasticsearchProject.cs @@ -15,23 +15,23 @@ public class ElasticsearchProject public string Version { get; set; } [ElasticProperty( OmitNorms = true, - Index = FieldIndexOption.not_analyzed )] + Index = FieldIndexOption.NotAnalyzed )] public string Country { get; set; } public string Content { get; set; } [ElasticProperty(Name="loc",AddSortField=true)] public int LOC { get; set; } public List Followers { get; set; } - [ElasticProperty(Type=FieldType.nested)] + [ElasticProperty(Type=FieldType.Nested)] public List Contributors { get; set; } public List NestedFollowers { get; set; } - [ElasticProperty(Type=FieldType.geo_point)] + [ElasticProperty(Type=FieldType.GeoPoint)] public GeoLocation Origin { get; set; } public DateTime StartedOn { get; set; } - [ElasticProperty(Type=FieldType.ip)] + [ElasticProperty(Type=FieldType.Ip)] public string PingIP { get; set; } public GeoShape MyGeoShape { get; set; } diff --git a/src/Tests/Nest.Tests.MockData/Domain/Person.cs b/src/Tests/Nest.Tests.MockData/Domain/Person.cs index 187eb6deca4..ab11aa9b90c 100644 --- a/src/Tests/Nest.Tests.MockData/Domain/Person.cs +++ b/src/Tests/Nest.Tests.MockData/Domain/Person.cs @@ -8,9 +8,9 @@ namespace Nest.Tests.MockData.Domain public class Person { public int Id { get; set; } - [ElasticProperty(Index = FieldIndexOption.analyzed)] + [ElasticProperty(Index = FieldIndexOption.Analyzed)] public string FirstName { get; set; } - [ElasticProperty(Index = FieldIndexOption.analyzed)] + [ElasticProperty(Index = FieldIndexOption.Analyzed)] public string LastName { get; set; } public int Age { get; set; } public string Email { get; set; } diff --git a/src/Tests/Nest.Tests.Unit/Core/Map/DynamicTemplates/DynamicTemplatesTests.cs b/src/Tests/Nest.Tests.Unit/Core/Map/DynamicTemplates/DynamicTemplatesTests.cs index f9af80141b2..38a2ed53ffe 100644 --- a/src/Tests/Nest.Tests.Unit/Core/Map/DynamicTemplates/DynamicTemplatesTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/Map/DynamicTemplates/DynamicTemplatesTests.cs @@ -68,7 +68,7 @@ public void MultipleTemplates() .Name("string") .Match("str_*") .MatchMappingType("string") - .Mapping(tm => tm.String(sm=>sm.Index(FieldIndexOption.not_analyzed))) + .Mapping(tm => tm.String(sm=>sm.Index(FieldIndexOption.NotAnalyzed))) ) .Add(t => t .Name("numbers") diff --git a/src/Tests/Nest.Tests.Unit/Core/Map/FluentMappingFullExampleTests.cs b/src/Tests/Nest.Tests.Unit/Core/Map/FluentMappingFullExampleTests.cs index 017f548206b..0e13085f20a 100644 --- a/src/Tests/Nest.Tests.Unit/Core/Map/FluentMappingFullExampleTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/Map/FluentMappingFullExampleTests.cs @@ -129,7 +129,7 @@ public void MapFluentFull() .Similarity("mysimilarity") .IndexName("my_crazy_name_i_want_in_lucene") .IncludeInAll() - .Index(FieldIndexOption.analyzed) + .Index(FieldIndexOption.Analyzed) .IndexAnalyzer("standard") .IndexOptions(IndexOptions.Positions) .NullValue("my_special_null_value") @@ -180,8 +180,8 @@ public void MapFluentFull() ) .Attachment(s => s .Name(p => p.MyAttachment) - .FileField(fs => fs.Index(FieldIndexOption.not_analyzed).Store()) - .AuthorField(fs => fs.Index(FieldIndexOption.analyzed).Store(false)) + .FileField(fs => fs.Index(FieldIndexOption.NotAnalyzed).Store()) + .AuthorField(fs => fs.Index(FieldIndexOption.Analyzed).Store(false)) .DateField(fs => fs.Store(false).IncludeInAll()) ) .Object(s => s @@ -192,7 +192,7 @@ public void MapFluentFull() .MapFromAttributes() .Path("full") .Properties(pprops => pprops - .String(ps => ps.Name(p => p.FirstName).Index(FieldIndexOption.not_analyzed)) + .String(ps => ps.Name(p => p.FirstName).Index(FieldIndexOption.NotAnalyzed)) //etcetera ) ) @@ -206,15 +206,15 @@ public void MapFluentFull() .MapFromAttributes() .Path("full") .Properties(pprops => pprops - .String(ps => ps.Name(p => p.FirstName).Index(FieldIndexOption.not_analyzed)) + .String(ps => ps.Name(p => p.FirstName).Index(FieldIndexOption.NotAnalyzed)) //etcetera ) ) .MultiField(s => s .Name(p => p.Name) .Fields(pprops => pprops - .String(ps => ps.Name(p => p.Name).Index(FieldIndexOption.not_analyzed)) - .String(ps => ps.Name(p => p.Name.Suffix("searchable")).Index(FieldIndexOption.analyzed)) + .String(ps => ps.Name(p => p.Name).Index(FieldIndexOption.NotAnalyzed)) + .String(ps => ps.Name(p => p.Name.Suffix("searchable")).Index(FieldIndexOption.Analyzed)) ) ) .IP(s=>s diff --git a/src/Tests/Nest.Tests.Unit/Core/Map/MappingBehaviourTests.cs b/src/Tests/Nest.Tests.Unit/Core/Map/MappingBehaviourTests.cs index 0308ab2085f..0712e569f49 100644 --- a/src/Tests/Nest.Tests.Unit/Core/Map/MappingBehaviourTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/Map/MappingBehaviourTests.cs @@ -16,7 +16,7 @@ public class MappingBeghaviourTests : BaseJsonTests public class TestMappingObject { public string Id { get; set; } - [ElasticProperty(Name="namez", Index = FieldIndexOption.analyzed)] + [ElasticProperty(Name="namez", Index = FieldIndexOption.Analyzed)] public string Name { get; set; } } @@ -27,7 +27,7 @@ public void MapFromPropertiesCanBeOverwritten() var result = this._client.Map(m => m .MapFromAttributes() .Properties(pp => pp - .String(s => s.Name(p => p.Name).Index(FieldIndexOption.not_analyzed)) + .String(s => s.Name(p => p.Name).Index(FieldIndexOption.NotAnalyzed)) ) ); var request = result.ConnectionStatus.Request.Utf8String(); diff --git a/src/Tests/Nest.Tests.Unit/Core/Map/Properties/PropertiesTests.cs b/src/Tests/Nest.Tests.Unit/Core/Map/Properties/PropertiesTests.cs index 1510e4cf8db..731042010ae 100644 --- a/src/Tests/Nest.Tests.Unit/Core/Map/Properties/PropertiesTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/Map/Properties/PropertiesTests.cs @@ -19,7 +19,7 @@ public void StringProperty() .Similarity("mysimilarity") .IndexName("my_crazy_name_i_want_in_lucene") .IncludeInAll() - .Index(FieldIndexOption.analyzed) + .Index(FieldIndexOption.Analyzed) .IndexAnalyzer("standard") .IndexOptions(IndexOptions.Positions) .NullValue("my_special_null_value") @@ -117,10 +117,10 @@ public void AttachmentProperty() .Properties(props => props .Attachment(s => s .Name(p => p.MyAttachment) - .FileField(fs => fs.Index(FieldIndexOption.not_analyzed).Store()) - .TitleField(fs => fs.Index(FieldIndexOption.not_analyzed).Store(false)) - .MetadataField("contents", fs => fs.Index(FieldIndexOption.not_analyzed).Store(false)) - .AuthorField(fs => fs.Index(FieldIndexOption.analyzed).Store(false)) + .FileField(fs => fs.Index(FieldIndexOption.NotAnalyzed).Store()) + .TitleField(fs => fs.Index(FieldIndexOption.NotAnalyzed).Store(false)) + .MetadataField("contents", fs => fs.Index(FieldIndexOption.NotAnalyzed).Store(false)) + .AuthorField(fs => fs.Index(FieldIndexOption.Analyzed).Store(false)) .DateField(fs => fs.Store(false).IncludeInAll()) ) ) @@ -139,7 +139,7 @@ public void ObjectProperty() .IncludeInAll() .Path("full") .Properties(pprops => pprops - .String(ps => ps.Name(p => p.FirstName).Index(FieldIndexOption.not_analyzed)) + .String(ps => ps.Name(p => p.FirstName).Index(FieldIndexOption.NotAnalyzed)) //etcetera ) ) @@ -161,7 +161,7 @@ public void NestedObjectProperty() .IncludeInRoot() .Path("full") .Properties(pprops => pprops - .String(ps => ps.Name(p => p.FirstName).Index(FieldIndexOption.not_analyzed)) + .String(ps => ps.Name(p => p.FirstName).Index(FieldIndexOption.NotAnalyzed)) //etcetera ) ) @@ -177,8 +177,8 @@ public void MultiFieldProperty() .MultiField(s => s .Name(p => p.Name) .Fields(pprops => pprops - .String(ps => ps.Name(p => p.Name).Index(FieldIndexOption.not_analyzed)) - .String(ps => ps.Name(p => p.Name.Suffix("searchable")).Index(FieldIndexOption.analyzed)) + .String(ps => ps.Name(p => p.Name).Index(FieldIndexOption.NotAnalyzed)) + .String(ps => ps.Name(p => p.Name.Suffix("searchable")).Index(FieldIndexOption.Analyzed)) ) ) ) @@ -195,8 +195,8 @@ public void MultiFieldPropertyWithFullPath() .Name(p => p.Name) .Path(MultiFieldMappingPath.Full) .Fields(pprops => pprops - .String(ps => ps.Name(p => p.Name).Index(FieldIndexOption.not_analyzed)) - .String(ps => ps.Name(p => p.Name.Suffix("searchable")).Index(FieldIndexOption.analyzed)) + .String(ps => ps.Name(p => p.Name).Index(FieldIndexOption.NotAnalyzed)) + .String(ps => ps.Name(p => p.Name.Suffix("searchable")).Index(FieldIndexOption.Analyzed)) ) ) ) @@ -213,8 +213,8 @@ public void MultiFieldPropertyWithJustNamePath() .Name(p => p.Name) .Path(MultiFieldMappingPath.JustName) .Fields(pprops => pprops - .String(ps => ps.Name(p => p.Name).Index(FieldIndexOption.not_analyzed)) - .String(ps => ps.Name(p => p.Name.Suffix("searchable")).Index(FieldIndexOption.analyzed)) + .String(ps => ps.Name(p => p.Name).Index(FieldIndexOption.NotAnalyzed)) + .String(ps => ps.Name(p => p.Name.Suffix("searchable")).Index(FieldIndexOption.Analyzed)) ) ) ) diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoBoundingBoxFilterTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoBoundingBoxFilterTests.cs index e77a6a01a9a..740d6ca39c4 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoBoundingBoxFilterTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoBoundingBoxFilterTests.cs @@ -13,11 +13,11 @@ public void GeoBoundingBox_Deserializes(string cacheName, string cacheKey, bool { var geoBoundingBox = this.SerializeThenDeserialize(cacheName, cacheKey, cache, f=>f.GeoBoundingBox, - f=>f.GeoBoundingBox(p=>p.Origin, 0.1, 0.2, 0.3, 0.4, GeoExecution.memory) + f=>f.GeoBoundingBox(p=>p.Origin, 0.1, 0.2, 0.3, 0.4, GeoExecution.Memory) ); geoBoundingBox.Field.Should().Be("origin"); - geoBoundingBox.GeoExecution.Should().Be(GeoExecution.memory); + geoBoundingBox.GeoExecution.Should().Be(GeoExecution.Memory); geoBoundingBox.TopLeft.Should().Be("0.1, 0.2"); geoBoundingBox.BottomRight.Should().Be("0.3, 0.4"); } @@ -28,7 +28,7 @@ public void GeoBoundingBox_Array_Deserializes() //nest will always generate top_left: ""; but while parsing it will need to handle top_left: [] as well var filter = this.ParseSearchDescriptorFromFile(f => f.GeoBoundingBox, MethodBase.GetCurrentMethod(), @"GeoBoundingBox\Array"); filter.Field.Should().Be("origin"); - filter.GeoExecution.Should().Be(GeoExecution.memory); + filter.GeoExecution.Should().Be(GeoExecution.Memory); filter.TopLeft.Should().Be("0.1, 0.2"); filter.BottomRight.Should().Be("0.3, 0.4"); } @@ -39,7 +39,7 @@ public void GeoBoundingBox_Vertices_Serializes() //nest will always generate top_left: ""; but while parsing it will need to handle top: left: right: bottom: as well var filter = this.ParseSearchDescriptorFromFile(f => f.GeoBoundingBox, MethodBase.GetCurrentMethod(), @"GeoBoundingBox\Vertices"); filter.Field.Should().Be("origin"); - filter.GeoExecution.Should().Be(GeoExecution.memory); + filter.GeoExecution.Should().Be(GeoExecution.Memory); filter.TopLeft.Should().Be("-74.1, 40.73"); filter.BottomRight.Should().Be("-71.12, 40.01"); } @@ -50,7 +50,7 @@ public void GeoBoundingBox_LatLon_Serializes() //nest will always generate top_left: ""; but while parsing it will need to handle top: left: right: bottom: as well var filter = this.ParseSearchDescriptorFromFile(f => f.GeoBoundingBox, MethodBase.GetCurrentMethod(), @"GeoBoundingBox\LatLon"); filter.Field.Should().Be("origin"); - filter.GeoExecution.Should().Be(GeoExecution.memory); + filter.GeoExecution.Should().Be(GeoExecution.Memory); filter.TopLeft.Should().Be("-74.1, 40.73"); filter.BottomRight.Should().Be("-71.12, 40.01"); } diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoDistanceFilterTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoDistanceFilterTests.cs index eb45ab0585f..909fddae195 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoDistanceFilterTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoDistanceFilterTests.cs @@ -15,13 +15,13 @@ public void GeoDistance_Deserializes(string cacheName, string cacheKey, bool cac f=>f.GeoDistance(p=>p.Origin, gd=>gd .Distance(1.0, GeoUnit.Kilometers) .Location(2.1, 4.1) - .Optimize(GeoOptimizeBBox.indexed) + .Optimize(GeoOptimizeBBox.Indexed) ) ); geoDistanceFilter.Field.Should().Be("origin"); geoDistanceFilter.Location.Should().Be("2.1, 4.1"); - geoDistanceFilter.OptimizeBoundingBox.Should().Be(GeoOptimizeBBox.indexed); + geoDistanceFilter.OptimizeBoundingBox.Should().Be(GeoOptimizeBBox.Indexed); } } diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoDistanceRangeFilterTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoDistanceRangeFilterTests.cs index 4dc5b5dc933..c9ab12ade59 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoDistanceRangeFilterTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Filter/GeoDistanceRangeFilterTests.cs @@ -17,8 +17,8 @@ public void GeoDistanceRange_Deserializes(string cacheName, string cacheKey, boo .Distance(From: 12, To: 200, Unit: GeoUnit.Kilometers) .FromExclusive() .ToExclusive() - .DistanceType(GeoDistanceType.arc) - .Optimize(GeoOptimizeBBox.memory) + .DistanceType(GeoDistance.Arc) + .Optimize(GeoOptimizeBBox.Memory) ) ); @@ -27,7 +27,7 @@ public void GeoDistanceRange_Deserializes(string cacheName, string cacheKey, boo var from = (double)(geoDistanceRangeFilter.From); from.Should().Be(12); geoDistanceRangeFilter.Unit.Should().Be(GeoUnit.Kilometers); - geoDistanceRangeFilter.DistanceType.Should().Be(GeoDistanceType.arc); + geoDistanceRangeFilter.DistanceType.Should().Be(GeoDistance.Arc); } [Test] @@ -41,14 +41,14 @@ public void GeoDistanceRange_FromString_Deserializes(string cacheName, string ca .Distance(From: "12km", To:"15km") .FromExclusive() .ToExclusive() - .DistanceType(GeoDistanceType.arc) - .Optimize(GeoOptimizeBBox.memory) + .DistanceType(GeoDistance.Arc) + .Optimize(GeoOptimizeBBox.Memory) ) ); geoDistanceRangeFilter.Field.Should().Be("origin"); var from = (string)(geoDistanceRangeFilter.From); from.Should().Be("12km"); - geoDistanceRangeFilter.DistanceType.Should().Be(GeoDistanceType.arc); + geoDistanceRangeFilter.DistanceType.Should().Be(GeoDistance.Arc); } } diff --git a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/FunctionScoreQueryTests.cs b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/FunctionScoreQueryTests.cs index 462ade125b1..3ac06fc7e3b 100644 --- a/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/FunctionScoreQueryTests.cs +++ b/src/Tests/Nest.Tests.Unit/QueryParsers/Queries/FunctionScoreQueryTests.cs @@ -23,7 +23,7 @@ public void FunctionScore_Deserializes() ) .Query(qq=>Query1) .RandomScore(1337) - .ScoreMode(FunctionScoreMode.first) + .ScoreMode(FunctionScoreMode.First) .ScriptScore(s=>s .Script("My complex script") .Params(p=>p.Add("param", "paramvalue")) @@ -35,7 +35,7 @@ public void FunctionScore_Deserializes() q.BoostMode.Should().Be(FunctionBoostMode.Average); q.RandomScore.Should().NotBeNull(); q.RandomScore.Seed.Should().Be(1337); - q.ScoreMode.Should().Be(FunctionScoreMode.first); + q.ScoreMode.Should().Be(FunctionScoreMode.First); q.ScriptScore.Should().NotBeNull(); q.ScriptScore.Lang.Should().Be("mvel"); q.ScriptScore.Script.Should().Be("My complex script"); diff --git a/src/Tests/Nest.Tests.Unit/Search/Facets/GeoDistanceFacetJson.cs b/src/Tests/Nest.Tests.Unit/Search/Facets/GeoDistanceFacetJson.cs index 186e359e105..8b7cdef44a3 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Facets/GeoDistanceFacetJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Facets/GeoDistanceFacetJson.cs @@ -82,7 +82,7 @@ public void GeoDistanceUsingHashAndOptions() .OnValueField(f => f.Origin) .PinTo("drm3btev3e86") .Unit(GeoUnit.Miles) - .DistanceType(GeoDistance.arc) + .DistanceType(GeoDistance.Arc) ); var json = TestElasticClient.Serialize(s); var expected = @"{ from: 0, size: 10, @@ -112,7 +112,7 @@ public void GeoDistanceScript() .Params(p=>p.Add("factor", 5)) .PinTo(40, -70) .Unit(GeoUnit.Miles) - .DistanceType(GeoDistance.arc) + .DistanceType(GeoDistance.Arc) ); var json = TestElasticClient.Serialize(s); var expected = @"{ from: 0, size: 10, diff --git a/src/Tests/Nest.Tests.Unit/Search/Facets/TermsFacetJson.cs b/src/Tests/Nest.Tests.Unit/Search/Facets/TermsFacetJson.cs index c210e6aa546..9ab908a0c9e 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Facets/TermsFacetJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Facets/TermsFacetJson.cs @@ -39,10 +39,10 @@ public void TestTermFacetAll() .OnField(f => f.Country) .Size(20) .ShardSize(100) - .Order(TermsOrder.reverse_count) + .Order(TermsOrder.ReverseCount) .Exclude("term1", "term2") .AllTerms() - .Regex(@"\s+", EsRegexFlags.DOTALL) + .Regex(@"\s+", "DOTALL") .Script("term + 'aaa'") .ScriptField("_source.my_field") ); @@ -81,7 +81,7 @@ public void TestTermFacetAllMultiFields() .FacetTerm(t => t .OnFields(f => f.Country, f => f.LOC) .Size(20) - .Order(TermsOrder.reverse_count) + .Order(TermsOrder.ReverseCount) .Exclude("term1", "term2") .AllTerms() .Regex(@"\s+", "DOTALL") @@ -97,7 +97,7 @@ public void TestTermFacetAllMultiFields() .FacetTerm("i_bet_this_crazy_facet_actually_works", t => t .OnFields(f => f.Country, f => f.LOC) .Size(20) - .Order(TermsOrder.reverse_count) + .Order(TermsOrder.ReverseCount) .Exclude("term1", "term2") .AllTerms() .Regex(@"\s+","DOTALL") diff --git a/src/Tests/Nest.Tests.Unit/Search/Facets/TermsStatsFacetJson.cs b/src/Tests/Nest.Tests.Unit/Search/Facets/TermsStatsFacetJson.cs index 9243de5581d..f872b7c1911 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Facets/TermsStatsFacetJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Facets/TermsStatsFacetJson.cs @@ -40,7 +40,7 @@ public void TermsStatsScript() .FacetTermsStats("date_minute", ts => ts .KeyScript("doc['date'].date.minuteOfHour * factor1") .ValueScript("doc['num1'].value * factor2") - .Order(TermsStatsOrder.reverse_max) + .Order(TermsStatsOrder.ReverseMax) .Params(p=>p .Add("factor1", 2) .Add("factor2", 3) diff --git a/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoBoundingBoxFilterJson.cs b/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoBoundingBoxFilterJson.cs index cb298b48fb0..92e32685ed9 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoBoundingBoxFilterJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoBoundingBoxFilterJson.cs @@ -43,7 +43,7 @@ public void GeoBoundingBoxFilterCacheNamed() topLeftY: -74.1, bottomRightX: 40.717, bottomRightY: -73.99, - type: GeoExecution.indexed + type: GeoExecution.Indexed ) ); diff --git a/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoDistanceFilterJson.cs b/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoDistanceFilterJson.cs index 86af4b5f526..2ab8b70cd38 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoDistanceFilterJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoDistanceFilterJson.cs @@ -18,7 +18,7 @@ public void GeoDistanceFilter() .GeoDistance(f=>f.Origin, d=>d .Location(Lat: 40, Lon: -70) .Distance(12, GeoUnit.Kilometers) - .Optimize(GeoOptimizeBBox.memory) + .Optimize(GeoOptimizeBBox.Memory) ) ); diff --git a/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoDistanceRangeFilterJson.cs b/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoDistanceRangeFilterJson.cs index 4341afa22c3..75ca104c76b 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoDistanceRangeFilterJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Filter/Singles/GeoDistanceRangeFilterJson.cs @@ -18,7 +18,7 @@ public void GeoDistanceRangeFilter() .GeoDistanceRange(f=>f.Origin, d=>d .Location(Lat: 40, Lon: -70) .Distance(From: 12, To: 200, Unit: GeoUnit.Kilometers) - .Optimize(GeoOptimizeBBox.memory) + .Optimize(GeoOptimizeBBox.Memory) ) ); diff --git a/src/Tests/Nest.Tests.Unit/Search/InitializerSyntax/InitializerExample.cs b/src/Tests/Nest.Tests.Unit/Search/InitializerSyntax/InitializerExample.cs index 94ee3b91006..e345b563fb3 100644 --- a/src/Tests/Nest.Tests.Unit/Search/InitializerSyntax/InitializerExample.cs +++ b/src/Tests/Nest.Tests.Unit/Search/InitializerSyntax/InitializerExample.cs @@ -134,7 +134,7 @@ public void FullExample_InitializerSyntax_Search() { Field = Property.Path(p=>p.Name), Size = 10, - ExecutionHint = TermsAggregationExecutionHint.ordinals, + ExecutionHint = TermsAggregationExecutionHint.Ordinals, }, Aggregations = new Dictionary { diff --git a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/FunctionScoreQueryJson.cs b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/FunctionScoreQueryJson.cs index 9ed8cbd4026..f2e1fd340e3 100644 --- a/src/Tests/Nest.Tests.Unit/Search/Query/Singles/FunctionScoreQueryJson.cs +++ b/src/Tests/Nest.Tests.Unit/Search/Query/Singles/FunctionScoreQueryJson.cs @@ -18,10 +18,10 @@ public void FunctionScoreQuery() f => f.Linear(x => x.FloatValue, d => d.Scale("0.3")), f => f.Exp(x => x.DoubleValue, d => d.Scale("0.5")), f => f.BoostFactor(2.0), - f => f.FieldValueFactor(op => op.Field(ff => ff.DoubleValue).Factor(2.5).Modifier(FieldValueFactorModifier.sqrt)) + f => f.FieldValueFactor(op => op.Field(ff => ff.DoubleValue).Factor(2.5).Modifier(FieldValueFactorModifier.SquareRoot)) ) - .ScoreMode(FunctionScoreMode.sum) - .BoostMode(FunctionBoostMode.replace) + .ScoreMode(FunctionScoreMode.Sum) + .BoostMode(FunctionBoostMode.Replace) ) ).Fields(x => x.Content); @@ -59,10 +59,10 @@ public void FunctionScoreQueryConditionless() f => f.Linear(x => x.FloatValue, d => d.Scale("0.3")), f => f.Exp(x => x.DoubleValue, d => d.Scale("0.5")), f => f.BoostFactor(2), - f => f.FieldValueFactor(db => db.Field(fa => fa.DoubleValue).Factor(3.4).Modifier(FieldValueFactorModifier.ln)) + f => f.FieldValueFactor(db => db.Field(fa => fa.DoubleValue).Factor(3.4).Modifier(FieldValueFactorModifier.Ln)) ) - .ScoreMode(FunctionScoreMode.sum) - .BoostMode(FunctionBoostMode.replace) + .ScoreMode(FunctionScoreMode.Sum) + .BoostMode(FunctionBoostMode.Replace) ) ).Fields(x => x.Content); @@ -95,7 +95,7 @@ public void ConditionlessFieldValueFactor() .FunctionScore(fs => fs .Query(qq => qq.Term("", "")) .Functions( - f => f.FieldValueFactor(db => db.Factor(3.4).Modifier(FieldValueFactorModifier.ln)) + f => f.FieldValueFactor(db => db.Factor(3.4).Modifier(FieldValueFactorModifier.Ln)) )) )); } From 36a3910e46674b37fdc53a629507ef76ffd906e4 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 25 Jun 2014 17:29:11 +0200 Subject: [PATCH 5/8] added StringEnumConverters to the remaining enums --- src/Nest/Enums/GeoTree.cs | 3 +++ src/Nest/Enums/IndexOptions.cs | 3 +++ src/Nest/Enums/NestedScore.cs | 2 ++ src/Nest/Enums/NumericIndexOption.cs | 3 +++ src/Nest/Enums/NumericType.cs | 3 +++ src/Nest/Enums/Operator.cs | 3 +++ src/Nest/Enums/TermsAggregationExecutionHint.cs | 3 +++ src/Nest/Enums/TextQueryType.cs | 3 +++ src/Nest/Enums/TopChildrenScore.cs | 2 ++ 9 files changed, 25 insertions(+) diff --git a/src/Nest/Enums/GeoTree.cs b/src/Nest/Enums/GeoTree.cs index 49accae3cca..139a5a1b9a8 100644 --- a/src/Nest/Enums/GeoTree.cs +++ b/src/Nest/Enums/GeoTree.cs @@ -1,7 +1,10 @@ using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { + [JsonConverter(typeof(StringEnumConverter))] public enum GeoTree { [EnumMember(Value = "geohash")] diff --git a/src/Nest/Enums/IndexOptions.cs b/src/Nest/Enums/IndexOptions.cs index c252e78957e..71d7cc7e376 100644 --- a/src/Nest/Enums/IndexOptions.cs +++ b/src/Nest/Enums/IndexOptions.cs @@ -1,7 +1,10 @@ using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { + [JsonConverter(typeof(StringEnumConverter))] public enum IndexOptions { [EnumMember(Value="docs")] diff --git a/src/Nest/Enums/NestedScore.cs b/src/Nest/Enums/NestedScore.cs index ff93c04f812..92a6bfd7ab2 100644 --- a/src/Nest/Enums/NestedScore.cs +++ b/src/Nest/Enums/NestedScore.cs @@ -4,9 +4,11 @@ using System.Text; using Newtonsoft.Json; using System.Runtime.Serialization; +using Newtonsoft.Json.Converters; namespace Nest { + [JsonConverter(typeof(StringEnumConverter))] public enum NestedScore { [EnumMember(Value = "avg")] diff --git a/src/Nest/Enums/NumericIndexOption.cs b/src/Nest/Enums/NumericIndexOption.cs index cfc94da3cd3..566d4a09958 100644 --- a/src/Nest/Enums/NumericIndexOption.cs +++ b/src/Nest/Enums/NumericIndexOption.cs @@ -1,7 +1,10 @@ using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { + [JsonConverter(typeof(StringEnumConverter))] public enum NonStringIndexOption { [EnumMember(Value = "no")] diff --git a/src/Nest/Enums/NumericType.cs b/src/Nest/Enums/NumericType.cs index efc64d9d334..55809479474 100644 --- a/src/Nest/Enums/NumericType.cs +++ b/src/Nest/Enums/NumericType.cs @@ -1,7 +1,10 @@ using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { + [JsonConverter(typeof(StringEnumConverter))] public enum NumberType { [EnumMember(Value = "default")] diff --git a/src/Nest/Enums/Operator.cs b/src/Nest/Enums/Operator.cs index 3580bbdc499..360df6d3fd1 100644 --- a/src/Nest/Enums/Operator.cs +++ b/src/Nest/Enums/Operator.cs @@ -1,7 +1,10 @@ using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { + [JsonConverter(typeof(StringEnumConverter))] public enum Operator { [EnumMember(Value = "and")] diff --git a/src/Nest/Enums/TermsAggregationExecutionHint.cs b/src/Nest/Enums/TermsAggregationExecutionHint.cs index 672702df3df..a7fa05d6167 100644 --- a/src/Nest/Enums/TermsAggregationExecutionHint.cs +++ b/src/Nest/Enums/TermsAggregationExecutionHint.cs @@ -1,10 +1,13 @@ using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { /// /// Determines how the terms aggregation is executed /// + [JsonConverter(typeof(StringEnumConverter))] public enum TermsAggregationExecutionHint { /// diff --git a/src/Nest/Enums/TextQueryType.cs b/src/Nest/Enums/TextQueryType.cs index d6d90acf2e8..2fc5c9b18d9 100644 --- a/src/Nest/Enums/TextQueryType.cs +++ b/src/Nest/Enums/TextQueryType.cs @@ -1,7 +1,10 @@ using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Nest { + [JsonConverter(typeof(StringEnumConverter))] public enum TextQueryType { [EnumMember(Value = "best_fields")] diff --git a/src/Nest/Enums/TopChildrenScore.cs b/src/Nest/Enums/TopChildrenScore.cs index 1962bfa19b8..1f2280995ee 100644 --- a/src/Nest/Enums/TopChildrenScore.cs +++ b/src/Nest/Enums/TopChildrenScore.cs @@ -4,9 +4,11 @@ using System.Text; using Newtonsoft.Json; using System.Runtime.Serialization; +using Newtonsoft.Json.Converters; namespace Nest { + [JsonConverter(typeof(StringEnumConverter))] public enum TopChildrenScore { [EnumMember(Value="max")] From b992e0031970be58d0614e691cf7ba317b4396e7 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 25 Jun 2014 17:52:32 +0200 Subject: [PATCH 6/8] Replaced all the Enum.GetNames to extension method taking into account EnumMember, fix #739 fix #740 --- .../Facets/DateHistogramFacetDescriptor.cs | 6 +++--- src/Nest/DSL/Visitor/DslPrettyPrintVisitor.cs | 2 +- .../Descriptors/NumberMappingDescriptor.cs | 2 +- src/Nest/Extensions/Extensions.cs | 21 ++++++++++++++++--- .../Filters/GeoBoundingFilterConverter.cs | 2 +- .../Filters/GeoDistanceFilterConverter.cs | 6 +++--- .../GeoDistanceRangeFilterConverter.cs | 6 +++--- .../Filters/TermsFilterConverter.cs | 2 +- .../Queries/FuzzyQueryJsonConverter.cs | 2 +- .../Queries/MatchQueryJsonConverter.cs | 4 ++-- .../WritePropertiesFromAttributeVisitor.cs | 10 ++++----- 11 files changed, 39 insertions(+), 24 deletions(-) diff --git a/src/Nest/DSL/Facets/DateHistogramFacetDescriptor.cs b/src/Nest/DSL/Facets/DateHistogramFacetDescriptor.cs index 22baf083bfa..7bad4ac30fa 100644 --- a/src/Nest/DSL/Facets/DateHistogramFacetDescriptor.cs +++ b/src/Nest/DSL/Facets/DateHistogramFacetDescriptor.cs @@ -117,14 +117,14 @@ public DateHistogramFacetDescriptor OnField(Expression> objec } public DateHistogramFacetDescriptor Interval(DateInterval interval) { - var intervalString = Enum.GetName(typeof(DateInterval), interval).ToLowerInvariant(); + var intervalString = interval.GetStringValue(); Self.Interval = intervalString; return this; } public DateHistogramFacetDescriptor Interval(DateInterval interval, DateRounding dateRounding) { - var intervalString = Enum.GetName(typeof(DateInterval), interval).ToLowerInvariant(); - var roundingString = Enum.GetName(typeof(DateRounding), dateRounding).ToLowerInvariant(); + var intervalString = interval.GetStringValue(); + var roundingString = dateRounding.GetStringValue(); Self.Interval = intervalString + ":" + roundingString; return this; } diff --git a/src/Nest/DSL/Visitor/DslPrettyPrintVisitor.cs b/src/Nest/DSL/Visitor/DslPrettyPrintVisitor.cs index e0c74bfe879..d737d1432cc 100644 --- a/src/Nest/DSL/Visitor/DslPrettyPrintVisitor.cs +++ b/src/Nest/DSL/Visitor/DslPrettyPrintVisitor.cs @@ -61,7 +61,7 @@ private void Write(string queryType, Dictionary properties) properties = properties ?? new Dictionary(); var props = string.Join(", ", properties.Select(kv => "{0}: {1}".F(kv.Key, kv.Value))); var indent = new String('-',(Depth -1) * 2); - var scope = Enum.GetName(typeof(VisitorScope), this.Scope).ToLowerInvariant(); + var scope = this.Scope.GetStringValue().ToLowerInvariant(); _sb.AppendFormat("{0}{1}: {2} ({3}){4}", indent, scope, queryType, props, Environment.NewLine); } private void Write(string queryType, PropertyPathMarker fieldName = null) diff --git a/src/Nest/Domain/Mapping/Descriptors/NumberMappingDescriptor.cs b/src/Nest/Domain/Mapping/Descriptors/NumberMappingDescriptor.cs index 035434d2a01..3ebc17f18f3 100644 --- a/src/Nest/Domain/Mapping/Descriptors/NumberMappingDescriptor.cs +++ b/src/Nest/Domain/Mapping/Descriptors/NumberMappingDescriptor.cs @@ -21,7 +21,7 @@ public NumberMappingDescriptor Name(Expression> objectPath) public NumberMappingDescriptor Type(NumberType type) { - var stringType = Enum.GetName(typeof (NumberType), type); + var stringType = type.GetStringValue(); this._Mapping.Type = stringType; return this; } diff --git a/src/Nest/Extensions/Extensions.cs b/src/Nest/Extensions/Extensions.cs index 7068127a5cb..07e07811320 100644 --- a/src/Nest/Extensions/Extensions.cs +++ b/src/Nest/Extensions/Extensions.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Runtime.Serialization; using System.Text; @@ -13,6 +14,8 @@ namespace Nest { internal static class Extensions { + internal static INestSerializer Serializer = new NestSerializer(new ConnectionSettings()); + internal static string GetStringValue(this Enum enumValue) { var type = enumValue.GetType(); @@ -25,11 +28,23 @@ internal static string GetStringValue(this Enum enumValue) return string.Empty; } + + public static T? ToEnum(this string str) where T : struct + { + var enumType = typeof(T); + foreach (var name in Enum.GetNames(enumType)) + { + var enumMemberAttribute = ((EnumMemberAttribute[])enumType.GetField(name).GetCustomAttributes(typeof(EnumMemberAttribute), true)).Single(); + if (enumMemberAttribute.Value == str) return (T)Enum.Parse(enumType, name); + } + //throw exception or whatever handling you want or + return null; + } internal static string Utf8String(this byte[] bytes) { return bytes == null ? null : Encoding.UTF8.GetString(bytes); } - + internal static byte[] Utf8Bytes(this string s) { return s.IsNullOrEmpty() ? null : Encoding.UTF8.GetBytes(s); @@ -101,7 +116,7 @@ internal static bool IsNullOrEmpty(this string value) { return string.IsNullOrEmpty(value); } - + internal static void ForEachWithIndex(this IEnumerable enumerable, Action handler) { @@ -110,7 +125,7 @@ internal static void ForEachWithIndex(this IEnumerable enumerable, Action< handler(item, idx++); } - + internal static IEnumerable EmptyIfNull(this IEnumerable xs) { if (xs == null) diff --git a/src/Nest/Resolvers/Converters/Filters/GeoBoundingFilterConverter.cs b/src/Nest/Resolvers/Converters/Filters/GeoBoundingFilterConverter.cs index a75f5288c24..99dc716ac8c 100644 --- a/src/Nest/Resolvers/Converters/Filters/GeoBoundingFilterConverter.cs +++ b/src/Nest/Resolvers/Converters/Filters/GeoBoundingFilterConverter.cs @@ -89,7 +89,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist break; case "type": reader.Read(); - f.GeoExecution = Enum.Parse(typeof(GeoExecution), reader.Value as string) as GeoExecution?; + f.GeoExecution = (reader.Value as string).ToEnum(); break; default: f.Field = property; diff --git a/src/Nest/Resolvers/Converters/Filters/GeoDistanceFilterConverter.cs b/src/Nest/Resolvers/Converters/Filters/GeoDistanceFilterConverter.cs index c1398f630f1..b330ee40de9 100644 --- a/src/Nest/Resolvers/Converters/Filters/GeoDistanceFilterConverter.cs +++ b/src/Nest/Resolvers/Converters/Filters/GeoDistanceFilterConverter.cs @@ -75,13 +75,13 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist filter.Distance = jv.Value.Value(); break; case "distance_type": - filter.DistanceType = Enum.Parse(typeof(GeoDistance), jv.Value.Value()) as GeoDistance?; + filter.DistanceType = jv.Value.Value().ToEnum(); break; case "optimize_bbox": - filter.OptimizeBoundingBox = Enum.Parse(typeof(GeoOptimizeBBox), jv.Value.Value()) as GeoOptimizeBBox?; + filter.OptimizeBoundingBox = jv.Value.Value().ToEnum(); break; case "unit": - filter.Unit = Enum.Parse(typeof(GeoUnit), jv.Value.Value()) as GeoUnit?; + filter.Unit = jv.Value.Value().ToEnum(); break; case "_cache": filter.Cache = jv.Value.Value(); diff --git a/src/Nest/Resolvers/Converters/Filters/GeoDistanceRangeFilterConverter.cs b/src/Nest/Resolvers/Converters/Filters/GeoDistanceRangeFilterConverter.cs index 1ad7243645f..3a1be570e88 100644 --- a/src/Nest/Resolvers/Converters/Filters/GeoDistanceRangeFilterConverter.cs +++ b/src/Nest/Resolvers/Converters/Filters/GeoDistanceRangeFilterConverter.cs @@ -87,13 +87,13 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist filter.To = jv.Value.Value(); break; case "distance_type": - filter.DistanceType = Enum.Parse(typeof(GeoDistance), jv.Value.Value()) as GeoDistance?; + filter.DistanceType = jv.Value.Value().ToEnum(); break; case "optimize_bbox": - filter.OptimizeBoundingBox = Enum.Parse(typeof(GeoOptimizeBBox), jv.Value.Value()) as GeoOptimizeBBox?; + filter.OptimizeBoundingBox = jv.Value.Value().ToEnum(); break; case "unit": - filter.Unit = Enum.Parse(typeof(GeoUnit), jv.Value.Value()) as GeoUnit?; + filter.Unit = jv.Value.Value().ToEnum(); break; case "_cache": filter.Cache = jv.Value.Value(); diff --git a/src/Nest/Resolvers/Converters/Filters/TermsFilterConverter.cs b/src/Nest/Resolvers/Converters/Filters/TermsFilterConverter.cs index 44622354563..c33230b504d 100644 --- a/src/Nest/Resolvers/Converters/Filters/TermsFilterConverter.cs +++ b/src/Nest/Resolvers/Converters/Filters/TermsFilterConverter.cs @@ -134,7 +134,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist } if (filter == null) return null; if (execution != null) - filter.Execution = Enum.Parse(typeof(TermsExecution), execution) as TermsExecution?; + filter.Execution = execution.ToEnum(); filter.Field = field; filter.Cache = cache; filter.CacheKey = cacheKey; diff --git a/src/Nest/Resolvers/Converters/Queries/FuzzyQueryJsonConverter.cs b/src/Nest/Resolvers/Converters/Queries/FuzzyQueryJsonConverter.cs index d1b41251d70..a8977eb2c87 100644 --- a/src/Nest/Resolvers/Converters/Queries/FuzzyQueryJsonConverter.cs +++ b/src/Nest/Resolvers/Converters/Queries/FuzzyQueryJsonConverter.cs @@ -58,7 +58,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist fq.Transpositions = GetPropValue(jo, "transpositions"); var rewriteString = GetPropValue(jo, "rewrite"); if (!rewriteString.IsNullOrEmpty()) - fq.Rewrite = Enum.Parse(typeof(RewriteMultiTerm), rewriteString) as RewriteMultiTerm?; + fq.Rewrite = rewriteString.ToEnum(); if (fq is IStringFuzzyQuery) { diff --git a/src/Nest/Resolvers/Converters/Queries/MatchQueryJsonConverter.cs b/src/Nest/Resolvers/Converters/Queries/MatchQueryJsonConverter.cs index 00f2ac258c7..b298182389f 100644 --- a/src/Nest/Resolvers/Converters/Queries/MatchQueryJsonConverter.cs +++ b/src/Nest/Resolvers/Converters/Queries/MatchQueryJsonConverter.cs @@ -58,11 +58,11 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist var rewriteString = GetPropValue(jo, "rewrite"); if (!rewriteString.IsNullOrEmpty()) - fq.Rewrite = Enum.Parse(typeof(RewriteMultiTerm), rewriteString) as RewriteMultiTerm?; + fq.Rewrite = rewriteString.ToEnum(); var operatorString = GetPropValue(jo, "operator"); if (!rewriteString.IsNullOrEmpty()) - fq.Operator = Enum.Parse(typeof(Operator), operatorString) as Operator?; + fq.Operator = operatorString.ToEnum(); return fq; } diff --git a/src/Nest/Resolvers/Writers/WritePropertiesFromAttributeVisitor.cs b/src/Nest/Resolvers/Writers/WritePropertiesFromAttributeVisitor.cs index a4733549973..a56b886855e 100644 --- a/src/Nest/Resolvers/Writers/WritePropertiesFromAttributeVisitor.cs +++ b/src/Nest/Resolvers/Writers/WritePropertiesFromAttributeVisitor.cs @@ -35,7 +35,7 @@ public void VisitBaseAttribute(IElasticPropertyAttribute att) { if (att.NumericType != NumberType.Default) { this._jsonWriter.WritePropertyName("type"); - string numericType = Enum.GetName(typeof (NumberType), att.NumericType); + var numericType = att.NumericType.GetStringValue(); this._jsonWriter.WriteValue(numericType.ToLowerInvariant()); } else @@ -76,12 +76,12 @@ public void VisitBaseAttribute(IElasticPropertyAttribute att) { if (att.Index != FieldIndexOption.Analyzed) { this._jsonWriter.WritePropertyName("index"); - this._jsonWriter.WriteValue(Enum.GetName(typeof (FieldIndexOption), att.Index)); + this._jsonWriter.WriteValue(att.Index.GetStringValue()); } if (att.TermVector != TermVectorOption.No) { this._jsonWriter.WritePropertyName("term_vector"); - this._jsonWriter.WriteValue(Enum.GetName(typeof (TermVectorOption), att.TermVector)); + this._jsonWriter.WriteValue(att.TermVector.GetStringValue()); } if (att.OmitNorms) { @@ -133,7 +133,7 @@ public void VisitBaseAttribute(IElasticPropertyAttribute att) { if (att.NumericType != NumberType.Default) { this._jsonWriter.WritePropertyName("type"); - string numericType = Enum.GetName(typeof (NumberType), att.NumericType); + string numericType = att.NumericType.GetStringValue(); this._jsonWriter.WriteValue(numericType.ToLowerInvariant()); } else @@ -144,7 +144,7 @@ public void VisitBaseAttribute(IElasticPropertyAttribute att) { if (att.SortAnalyzer.IsNullOrEmpty()) { this._jsonWriter.WritePropertyName("index"); - this._jsonWriter.WriteValue(Enum.GetName(typeof(FieldIndexOption), FieldIndexOption.NotAnalyzed)); + this._jsonWriter.WriteValue(FieldIndexOption.NotAnalyzed.GetStringValue()); } else { From 5c82b61a93355aed6dc05a487e554f4b5d4f9561 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 25 Jun 2014 21:09:18 +0200 Subject: [PATCH 7/8] Remove Options suffix from all the generated enums, less smurfing and clearer public API --- .../ApiGenerator.cs | 21 +- .../CodeGeneration.LowLevelClient.csproj | 2 + .../Domain/ApiEndpoint.cs | 2 +- .../Domain/ApiQueryParameters.cs | 2 +- .../Domain/RestApiSpec.cs | 2 +- .../ClearCacheDescriptorOverrides.cs | 2 + .../DeleteWarmerDescriptorOverrides.cs | 2 + .../Descriptors/IDescriptorOverrides.cs | 21 ++ .../MultiTermVectorsDescriptorOverrides.cs | 1 + .../NodesHotThreadsDescriptorOverrides.cs | 31 +++ .../PutTemplateDescriptorOverrides.cs | 1 + .../Descriptors/SearchDescriptorOverrides.cs | 15 +- .../Connection/ConnectionConfiguration.cs | 4 +- .../Connection/IConnectionConfiguration.cs | 3 +- .../Domain/Enums.Generated.cs | 156 +++++------ .../Domain/RequestParameters.Generated.cs | 260 +++++++++--------- src/Nest/DSL/Bulk/BulkCreateDescriptor.cs | 2 +- src/Nest/DSL/Bulk/BulkDeleteDescriptor.cs | 2 +- src/Nest/DSL/Bulk/BulkIndexDescriptor.cs | 2 +- src/Nest/DSL/Bulk/BulkUpdateDescriptor.cs | 2 +- src/Nest/DSL/SearchDescriptor.cs | 10 +- .../DSL/Suggest/DirectGeneratorDescriptor.cs | 8 +- src/Nest/DSL/Suggest/TermSuggestDescriptor.cs | 8 +- src/Nest/DSL/_Descriptors.generated.cs | 130 ++++----- .../Domain/Responses/ReindexObservable.cs | 2 +- src/Nest/ExposedInternals/NestSerializer.cs | 16 +- .../Cluster/HealthTests.cs | 12 +- .../Nest.Tests.Integration/ConnectionTests.cs | 2 +- .../Core/ClearScroll/ClearScrollTests.cs | 2 +- .../Core/DeleteTests.cs | 2 +- .../Nest.Tests.Integration/Core/IndexTests.cs | 8 +- .../Core/MultiSearch/MultiSearchTests.cs | 2 +- .../Core/Suggest/SuggestTests.cs | 2 +- .../Nest.Tests.Integration.csproj | 10 +- .../Search/QueryDSLTests.cs | 2 +- .../Search/Scroll/ScrollTests.cs | 4 +- .../SearchTypeCountTests.cs | 4 +- .../SearchTypeScanTests.cs | 6 +- .../SearchTypeTests.cs | 10 +- .../SubClassSupport/SubClassSupportTests.cs | 6 +- .../Nest.Tests.Unit/BigBadUrlUnitTests.cs | 2 +- .../Nest.Tests.Unit/Cluster/HealthTests.cs | 12 +- .../Nest.Tests.Unit/Core/Bulk/BulkTests.cs | 8 +- .../Nest.Tests.Unit/Core/Bulk/BulkUrlTests.cs | 2 +- .../Core/Domain/Connection/ConnectionTests.cs | 4 +- .../Core/MoreLikeThis/MltUrlTests.cs | 2 +- .../Core/MultiSearch/MultiSearchTests.cs | 4 +- .../Core/Versioning/VersioningTests.cs | 2 +- .../Nest.Tests.Unit/Nest.Tests.Unit.csproj | 4 +- .../ScriptFieldTests.cs | 12 +- .../SearchTypeDoesNotPolluteQueryObject.json | 0 .../Search/suggest/PhraseSuggestTests.cs | 2 +- .../Search/suggest/TermSuggestTests.cs | 4 +- .../Settings/UsePrettyResponseTests.cs | 2 +- 54 files changed, 441 insertions(+), 398 deletions(-) create mode 100644 src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/IDescriptorOverrides.cs create mode 100644 src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/NodesHotThreadsDescriptorOverrides.cs rename src/Tests/Nest.Tests.Integration/Search/{SearchType => SearchTypeTests}/SearchTypeCountTests.cs (86%) rename src/Tests/Nest.Tests.Integration/Search/{SearchType => SearchTypeTests}/SearchTypeScanTests.cs (91%) rename src/Tests/Nest.Tests.Integration/Search/{SearchType => SearchTypeTests}/SearchTypeTests.cs (84%) rename src/Tests/Nest.Tests.Unit/Search/{SearchType => SearchTypeTests}/ScriptFieldTests.cs (67%) rename src/Tests/Nest.Tests.Unit/Search/{SearchType => SearchTypeTests}/SearchTypeDoesNotPolluteQueryObject.json (100%) diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/ApiGenerator.cs b/src/CodeGeneration/CodeGeneration.LowLevelClient/ApiGenerator.cs index ba846efddeb..be58ff88eb2 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/ApiGenerator.cs +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/ApiGenerator.cs @@ -155,8 +155,25 @@ public static void PatchMethod(CsharpMethod method) var overrides = Activator.CreateInstance(type) as IDescriptorOverrides; if (overrides == null) return; - method.Url.Params = method.Url.Params.Where(p => !overrides.SkipQueryStringParams.Contains(p.Key)) - .ToDictionary(k => k.Key, v => v.Value); + + foreach (var kv in method.Url.Params) + { + if (overrides.SkipQueryStringParams.Contains(kv.Key)) + method.Url.Params.Remove(kv.Key); + + if (overrides.RenameQueryStringParams == null) continue; + + string newName; + if (!overrides.RenameQueryStringParams.TryGetValue(kv.Key, out newName)) + continue; + + method.Url.Params.Remove(kv.Key); + method.Url.Params.Add(newName, kv.Value); + + } + + //method.Url.Params = method.Url.Params.Where(p => !overrides.SkipQueryStringParams.Contains(p.Key)) + // .ToDictionary(k => k.Key, v => v.Value); } // ReSharper disable once EmptyGeneralCatchClause catch diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/CodeGeneration.LowLevelClient.csproj b/src/CodeGeneration/CodeGeneration.LowLevelClient/CodeGeneration.LowLevelClient.csproj index 95398c0fada..bb82a9c456e 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/CodeGeneration.LowLevelClient.csproj +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/CodeGeneration.LowLevelClient.csproj @@ -79,6 +79,8 @@ + + diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/ApiEndpoint.cs b/src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/ApiEndpoint.cs index ca027229f65..d916fd70041 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/ApiEndpoint.cs +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/ApiEndpoint.cs @@ -123,7 +123,7 @@ public IEnumerable CsharpMethods case "list": return "string " + p.Name; case "enum": - return this.PascalCase(p.Name) + "Options " + p.Name; + return this.PascalCase(p.Name) + p.Name; default: return p.Type + " " + p.Name; //return "string " + p.Name; diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/ApiQueryParameters.cs b/src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/ApiQueryParameters.cs index 320ff729dcd..5d97b385d64 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/ApiQueryParameters.cs +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/ApiQueryParameters.cs @@ -27,7 +27,7 @@ public string CsharpType(string paramName) case null: return "string"; case "enum": - return paramName.ToPascalCase() + "Options"; + return paramName.ToPascalCase(); default: return this.Type; } diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/RestApiSpec.cs b/src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/RestApiSpec.cs index 5f26e2a54dc..30355f3b234 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/RestApiSpec.cs +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/Domain/RestApiSpec.cs @@ -24,7 +24,7 @@ public IEnumerable EnumsInTheSpec get { var queryParamEnums = from m in this.CsharpMethodsWithQueryStringInfo.SelectMany(m => m.Url.Params) - where m.Value.CsharpType(m.Key).EndsWith("Options") + where m.Value.Type == "enum" select new EnumDescription { Name = m.Value.CsharpType(m.Key), diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/ClearCacheDescriptorOverrides.cs b/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/ClearCacheDescriptorOverrides.cs index 440f4e64935..f5f3cd69c01 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/ClearCacheDescriptorOverrides.cs +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/ClearCacheDescriptorOverrides.cs @@ -17,5 +17,7 @@ public IEnumerable SkipQueryStringParams }; } } + + public IDictionary RenameQueryStringParams { get { return null; } } } } diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/DeleteWarmerDescriptorOverrides.cs b/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/DeleteWarmerDescriptorOverrides.cs index 9242f327cd6..d3d7154c816 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/DeleteWarmerDescriptorOverrides.cs +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/DeleteWarmerDescriptorOverrides.cs @@ -17,5 +17,7 @@ public IEnumerable SkipQueryStringParams }; } } + + public IDictionary RenameQueryStringParams { get { return null; } } } } diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/IDescriptorOverrides.cs b/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/IDescriptorOverrides.cs new file mode 100644 index 00000000000..0ba660635ca --- /dev/null +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/IDescriptorOverrides.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; + +namespace CodeGeneration.LowLevelClient.Overrides.Descriptors +{ + /// + /// Tweaks the generated descriptors + /// + public interface IDescriptorOverrides + { + /// + /// Sometimes params can be defined on the body as well as on the querystring + /// We favor specifying params on the body so here we can specify params we don't want on the querystring. + /// + IEnumerable SkipQueryStringParams { get; } + + /// + /// Override how the query param name is exposed to the client. + /// + IDictionary RenameQueryStringParams { get; } + } +} \ No newline at end of file diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/MultiTermVectorsDescriptorOverrides.cs b/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/MultiTermVectorsDescriptorOverrides.cs index 64fe170a890..fa81153eddb 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/MultiTermVectorsDescriptorOverrides.cs +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/MultiTermVectorsDescriptorOverrides.cs @@ -18,5 +18,6 @@ public IEnumerable SkipQueryStringParams }; } } + public IDictionary RenameQueryStringParams { get { return null; } } } } diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/NodesHotThreadsDescriptorOverrides.cs b/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/NodesHotThreadsDescriptorOverrides.cs new file mode 100644 index 00000000000..0b7876590c8 --- /dev/null +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/NodesHotThreadsDescriptorOverrides.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace CodeGeneration.LowLevelClient.Overrides.Descriptors +{ + public class NodesHotThreadsDescriptorOverrides : IDescriptorOverrides + { + public IEnumerable SkipQueryStringParams + { + get + { + return new string[] + { + "fielddata" + }; + } + } + public IDictionary RenameQueryStringParams + { + get + { + return new Dictionary + { + { "type", "thread_type"} + }; + } + } + } +} diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/PutTemplateDescriptorOverrides.cs b/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/PutTemplateDescriptorOverrides.cs index 720ace49fc1..69e4a787652 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/PutTemplateDescriptorOverrides.cs +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/PutTemplateDescriptorOverrides.cs @@ -17,5 +17,6 @@ public IEnumerable SkipQueryStringParams }; } } + public IDictionary RenameQueryStringParams { get { return null; } } } } diff --git a/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/SearchDescriptorOverrides.cs b/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/SearchDescriptorOverrides.cs index 596a03e8f30..a0b2fc53549 100644 --- a/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/SearchDescriptorOverrides.cs +++ b/src/CodeGeneration/CodeGeneration.LowLevelClient/Overrides/Descriptors/SearchDescriptorOverrides.cs @@ -5,19 +5,6 @@ namespace CodeGeneration.LowLevelClient.Overrides.Descriptors { - /// - /// Tweaks the generated descriptors - /// - public interface IDescriptorOverrides - { - /// - /// Sometimes params can be defined on the body as well as on the querystring - /// We favor specifying params on the body so here we can specify params we don't want on the querystring. - /// - IEnumerable SkipQueryStringParams { get; } - } - - public class SearchDescriptorOverrides : IDescriptorOverrides { public IEnumerable SkipQueryStringParams @@ -40,5 +27,7 @@ public IEnumerable SkipQueryStringParams }; } } + + public IDictionary RenameQueryStringParams { get { return null; } } } } diff --git a/src/Elasticsearch.Net/Connection/ConnectionConfiguration.cs b/src/Elasticsearch.Net/Connection/ConnectionConfiguration.cs index 675d7c063cc..c605cc8affa 100644 --- a/src/Elasticsearch.Net/Connection/ConnectionConfiguration.cs +++ b/src/Elasticsearch.Net/Connection/ConnectionConfiguration.cs @@ -14,8 +14,7 @@ namespace Elasticsearch.Net.Connection /// public class ConnectionConfiguration : ConnectionConfiguration, - IConnectionConfiguration, - IHideObjectMembers + IConnectionConfiguration { /// /// ConnectionConfiguration allows you to control how ElasticsearchClient behaves and where/how it connects @@ -293,6 +292,7 @@ public T SetConnectionStatusHandler(Action handler) this._connectionStatusHandler = handler; return (T)this; } + } } diff --git a/src/Elasticsearch.Net/Connection/IConnectionConfiguration.cs b/src/Elasticsearch.Net/Connection/IConnectionConfiguration.cs index 5414115d0b2..78278e19ee6 100644 --- a/src/Elasticsearch.Net/Connection/IConnectionConfiguration.cs +++ b/src/Elasticsearch.Net/Connection/IConnectionConfiguration.cs @@ -4,8 +4,7 @@ namespace Elasticsearch.Net.Connection { public interface IConnectionConfiguration : - IConnectionConfiguration, - IHideObjectMembers + IConnectionConfiguration { } diff --git a/src/Elasticsearch.Net/Domain/Enums.Generated.cs b/src/Elasticsearch.Net/Domain/Enums.Generated.cs index e9e71e4fb6e..c43124bf21d 100644 --- a/src/Elasticsearch.Net/Domain/Enums.Generated.cs +++ b/src/Elasticsearch.Net/Domain/Enums.Generated.cs @@ -12,7 +12,7 @@ namespace Elasticsearch.Net { - public enum ConsistencyOptions + public enum Consistency { [EnumMember(Value = "one")] One, @@ -23,7 +23,7 @@ public enum ConsistencyOptions } - public enum ReplicationOptions + public enum Replication { [EnumMember(Value = "sync")] Sync, @@ -32,7 +32,7 @@ public enum ReplicationOptions } - public enum BytesOptions + public enum Bytes { [EnumMember(Value = "b")] B, @@ -45,7 +45,7 @@ public enum BytesOptions } - public enum LevelOptions + public enum Level { [EnumMember(Value = "cluster")] Cluster, @@ -56,7 +56,7 @@ public enum LevelOptions } - public enum WaitForStatusOptions + public enum WaitForStatus { [EnumMember(Value = "green")] Green, @@ -67,7 +67,7 @@ public enum WaitForStatusOptions } - public enum ExpandWildcardsOptions + public enum ExpandWildcards { [EnumMember(Value = "open")] Open, @@ -76,7 +76,7 @@ public enum ExpandWildcardsOptions } - public enum VersionTypeOptions + public enum VersionType { [EnumMember(Value = "internal")] Internal, @@ -89,7 +89,7 @@ public enum VersionTypeOptions } - public enum DefaultOperatorOptions + public enum DefaultOperator { [EnumMember(Value = "AND")] And, @@ -98,7 +98,7 @@ public enum DefaultOperatorOptions } - public enum OpTypeOptions + public enum OpType { [EnumMember(Value = "index")] Index, @@ -107,7 +107,7 @@ public enum OpTypeOptions } - public enum FormatOptions + public enum Format { [EnumMember(Value = "detailed")] Detailed, @@ -116,7 +116,7 @@ public enum FormatOptions } - public enum SearchTypeOptions + public enum SearchType { [EnumMember(Value = "query_then_fetch")] QueryThenFetch, @@ -133,7 +133,7 @@ public enum SearchTypeOptions } - public enum TypeOptions + public enum ThreadType { [EnumMember(Value = "cpu")] Cpu, @@ -144,7 +144,7 @@ public enum TypeOptions } - public enum SuggestModeOptions + public enum SuggestMode { [EnumMember(Value = "missing")] Missing, @@ -307,145 +307,145 @@ public static class KnownEnums public static string Resolve(Enum e) { - if (e is ConsistencyOptions) + if (e is Consistency) { - switch((ConsistencyOptions)e) + switch((Consistency)e) { - case ConsistencyOptions.One: return "one"; - case ConsistencyOptions.Quorum: return "quorum"; - case ConsistencyOptions.All: return "all"; + case Consistency.One: return "one"; + case Consistency.Quorum: return "quorum"; + case Consistency.All: return "all"; } } - if (e is ReplicationOptions) + if (e is Replication) { - switch((ReplicationOptions)e) + switch((Replication)e) { - case ReplicationOptions.Sync: return "sync"; - case ReplicationOptions.Async: return "async"; + case Replication.Sync: return "sync"; + case Replication.Async: return "async"; } } - if (e is BytesOptions) + if (e is Bytes) { - switch((BytesOptions)e) + switch((Bytes)e) { - case BytesOptions.B: return "b"; - case BytesOptions.K: return "k"; - case BytesOptions.M: return "m"; - case BytesOptions.G: return "g"; + case Bytes.B: return "b"; + case Bytes.K: return "k"; + case Bytes.M: return "m"; + case Bytes.G: return "g"; } } - if (e is LevelOptions) + if (e is Level) { - switch((LevelOptions)e) + switch((Level)e) { - case LevelOptions.Cluster: return "cluster"; - case LevelOptions.Indices: return "indices"; - case LevelOptions.Shards: return "shards"; + case Level.Cluster: return "cluster"; + case Level.Indices: return "indices"; + case Level.Shards: return "shards"; } } - if (e is WaitForStatusOptions) + if (e is WaitForStatus) { - switch((WaitForStatusOptions)e) + switch((WaitForStatus)e) { - case WaitForStatusOptions.Green: return "green"; - case WaitForStatusOptions.Yellow: return "yellow"; - case WaitForStatusOptions.Red: return "red"; + case WaitForStatus.Green: return "green"; + case WaitForStatus.Yellow: return "yellow"; + case WaitForStatus.Red: return "red"; } } - if (e is ExpandWildcardsOptions) + if (e is ExpandWildcards) { - switch((ExpandWildcardsOptions)e) + switch((ExpandWildcards)e) { - case ExpandWildcardsOptions.Open: return "open"; - case ExpandWildcardsOptions.Closed: return "closed"; + case ExpandWildcards.Open: return "open"; + case ExpandWildcards.Closed: return "closed"; } } - if (e is VersionTypeOptions) + if (e is VersionType) { - switch((VersionTypeOptions)e) + switch((VersionType)e) { - case VersionTypeOptions.Internal: return "internal"; - case VersionTypeOptions.External: return "external"; - case VersionTypeOptions.ExternalGte: return "external_gte"; - case VersionTypeOptions.Force: return "force"; + case VersionType.Internal: return "internal"; + case VersionType.External: return "external"; + case VersionType.ExternalGte: return "external_gte"; + case VersionType.Force: return "force"; } } - if (e is DefaultOperatorOptions) + if (e is DefaultOperator) { - switch((DefaultOperatorOptions)e) + switch((DefaultOperator)e) { - case DefaultOperatorOptions.And: return "AND"; - case DefaultOperatorOptions.Or: return "OR"; + case DefaultOperator.And: return "AND"; + case DefaultOperator.Or: return "OR"; } } - if (e is OpTypeOptions) + if (e is OpType) { - switch((OpTypeOptions)e) + switch((OpType)e) { - case OpTypeOptions.Index: return "index"; - case OpTypeOptions.Create: return "create"; + case OpType.Index: return "index"; + case OpType.Create: return "create"; } } - if (e is FormatOptions) + if (e is Format) { - switch((FormatOptions)e) + switch((Format)e) { - case FormatOptions.Detailed: return "detailed"; - case FormatOptions.Text: return "text"; + case Format.Detailed: return "detailed"; + case Format.Text: return "text"; } } - if (e is SearchTypeOptions) + if (e is SearchType) { - switch((SearchTypeOptions)e) + switch((SearchType)e) { - case SearchTypeOptions.QueryThenFetch: return "query_then_fetch"; - case SearchTypeOptions.QueryAndFetch: return "query_and_fetch"; - case SearchTypeOptions.DfsQueryThenFetch: return "dfs_query_then_fetch"; - case SearchTypeOptions.DfsQueryAndFetch: return "dfs_query_and_fetch"; - case SearchTypeOptions.Count: return "count"; - case SearchTypeOptions.Scan: return "scan"; + case SearchType.QueryThenFetch: return "query_then_fetch"; + case SearchType.QueryAndFetch: return "query_and_fetch"; + case SearchType.DfsQueryThenFetch: return "dfs_query_then_fetch"; + case SearchType.DfsQueryAndFetch: return "dfs_query_and_fetch"; + case SearchType.Count: return "count"; + case SearchType.Scan: return "scan"; } } - if (e is TypeOptions) + if (e is ThreadType) { - switch((TypeOptions)e) + switch((ThreadType)e) { - case TypeOptions.Cpu: return "cpu"; - case TypeOptions.Wait: return "wait"; - case TypeOptions.Block: return "block"; + case ThreadType.Cpu: return "cpu"; + case ThreadType.Wait: return "wait"; + case ThreadType.Block: return "block"; } } - if (e is SuggestModeOptions) + if (e is SuggestMode) { - switch((SuggestModeOptions)e) + switch((SuggestMode)e) { - case SuggestModeOptions.Missing: return "missing"; - case SuggestModeOptions.Popular: return "popular"; - case SuggestModeOptions.Always: return "always"; + case SuggestMode.Missing: return "missing"; + case SuggestMode.Popular: return "popular"; + case SuggestMode.Always: return "always"; } } diff --git a/src/Elasticsearch.Net/Domain/RequestParameters.Generated.cs b/src/Elasticsearch.Net/Domain/RequestParameters.Generated.cs index 61e804329a7..f9f11b0af2f 100644 --- a/src/Elasticsearch.Net/Domain/RequestParameters.Generated.cs +++ b/src/Elasticsearch.Net/Domain/RequestParameters.Generated.cs @@ -31,9 +31,9 @@ public class AbortBenchmarkRequestParameters : FluentRequestParameters { - internal ConsistencyOptions _consistency { get; set; } + internal Consistency _consistency { get; set; } ///Explicit write consistency setting for the operation - public BulkRequestParameters Consistency(ConsistencyOptions consistency) + public BulkRequestParameters Consistency(Consistency consistency) { this._consistency = consistency; this.AddQueryString("consistency", this._consistency); @@ -51,9 +51,9 @@ public BulkRequestParameters Refresh(bool refresh) } - internal ReplicationOptions _replication { get; set; } + internal Replication _replication { get; set; } ///Explicitely set the replication type - public BulkRequestParameters Replication(ReplicationOptions replication) + public BulkRequestParameters Replication(Replication replication) { this._replication = replication; this.AddQueryString("replication", this._replication); @@ -161,9 +161,9 @@ public CatAliasesRequestParameters V(bool v) public class CatAllocationRequestParameters : FluentRequestParameters { - internal BytesOptions _bytes { get; set; } + internal Bytes _bytes { get; set; } ///The unit in which to display byte values - public CatAllocationRequestParameters Bytes(BytesOptions bytes) + public CatAllocationRequestParameters Bytes(Bytes bytes) { this._bytes = bytes; this.AddQueryString("bytes", this._bytes); @@ -291,9 +291,9 @@ public CatCountRequestParameters V(bool v) public class CatFielddataRequestParameters : FluentRequestParameters { - internal BytesOptions _bytes { get; set; } + internal Bytes _bytes { get; set; } ///The unit in which to display byte values - public CatFielddataRequestParameters Bytes(BytesOptions bytes) + public CatFielddataRequestParameters Bytes(Bytes bytes) { this._bytes = bytes; this.AddQueryString("bytes", this._bytes); @@ -461,9 +461,9 @@ public CatHelpRequestParameters Help(bool help) public class CatIndicesRequestParameters : FluentRequestParameters { - internal BytesOptions _bytes { get; set; } + internal Bytes _bytes { get; set; } ///The unit in which to display byte values - public CatIndicesRequestParameters Bytes(BytesOptions bytes) + public CatIndicesRequestParameters Bytes(Bytes bytes) { this._bytes = bytes; this.AddQueryString("bytes", this._bytes); @@ -781,9 +781,9 @@ public CatPluginsRequestParameters V(bool v) public class CatRecoveryRequestParameters : FluentRequestParameters { - internal BytesOptions _bytes { get; set; } + internal Bytes _bytes { get; set; } ///The unit in which to display byte values - public CatRecoveryRequestParameters Bytes(BytesOptions bytes) + public CatRecoveryRequestParameters Bytes(Bytes bytes) { this._bytes = bytes; this.AddQueryString("bytes", this._bytes); @@ -1021,9 +1021,9 @@ public ClusterGetSettingsRequestParameters Timeout(string timeout) public class ClusterHealthRequestParameters : FluentRequestParameters { - internal LevelOptions _level { get; set; } + internal Level _level { get; set; } ///Specify the level of detail for returned information - public ClusterHealthRequestParameters Level(LevelOptions level) + public ClusterHealthRequestParameters Level(Level level) { this._level = level; this.AddQueryString("level", this._level); @@ -1091,9 +1091,9 @@ public ClusterHealthRequestParameters WaitForRelocatingShards(long wait_for_relo } - internal WaitForStatusOptions _wait_for_status { get; set; } + internal WaitForStatus _wait_for_status { get; set; } ///Wait until cluster is in a specific state - public ClusterHealthRequestParameters WaitForStatus(WaitForStatusOptions wait_for_status) + public ClusterHealthRequestParameters WaitForStatus(WaitForStatus wait_for_status) { this._wait_for_status = wait_for_status; this.AddQueryString("wait_for_status", this._wait_for_status); @@ -1311,9 +1311,9 @@ public CountRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public CountRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public CountRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -1411,9 +1411,9 @@ public PercolateCountRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public PercolateCountRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public PercolateCountRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -1451,9 +1451,9 @@ public PercolateCountRequestParameters Version(long version) } - internal VersionTypeOptions _version_type { get; set; } + internal VersionType _version_type { get; set; } ///Specific version type - public PercolateCountRequestParameters VersionType(VersionTypeOptions version_type) + public PercolateCountRequestParameters VersionType(VersionType version_type) { this._version_type = version_type; this.AddQueryString("version_type", this._version_type); @@ -1471,9 +1471,9 @@ public PercolateCountRequestParameters VersionType(VersionTypeOptions version_ty public class DeleteRequestParameters : FluentRequestParameters { - internal ConsistencyOptions _consistency { get; set; } + internal Consistency _consistency { get; set; } ///Specific write consistency setting for the operation - public DeleteRequestParameters Consistency(ConsistencyOptions consistency) + public DeleteRequestParameters Consistency(Consistency consistency) { this._consistency = consistency; this.AddQueryString("consistency", this._consistency); @@ -1501,9 +1501,9 @@ public DeleteRequestParameters Refresh(bool refresh) } - internal ReplicationOptions _replication { get; set; } + internal Replication _replication { get; set; } ///Specific replication type - public DeleteRequestParameters Replication(ReplicationOptions replication) + public DeleteRequestParameters Replication(Replication replication) { this._replication = replication; this.AddQueryString("replication", this._replication); @@ -1541,9 +1541,9 @@ public DeleteRequestParameters Version(long version) } - internal VersionTypeOptions _version_type { get; set; } + internal VersionType _version_type { get; set; } ///Specific version type - public DeleteRequestParameters VersionType(VersionTypeOptions version_type) + public DeleteRequestParameters VersionType(VersionType version_type) { this._version_type = version_type; this.AddQueryString("version_type", this._version_type); @@ -1571,9 +1571,9 @@ public DeleteByQueryRequestParameters Analyzer(string analyzer) } - internal ConsistencyOptions _consistency { get; set; } + internal Consistency _consistency { get; set; } ///Specific write consistency setting for the operation - public DeleteByQueryRequestParameters Consistency(ConsistencyOptions consistency) + public DeleteByQueryRequestParameters Consistency(Consistency consistency) { this._consistency = consistency; this.AddQueryString("consistency", this._consistency); @@ -1581,9 +1581,9 @@ public DeleteByQueryRequestParameters Consistency(ConsistencyOptions consistency } - internal DefaultOperatorOptions _default_operator { get; set; } + internal DefaultOperator _default_operator { get; set; } ///The default operator for query string query (AND or OR) - public DeleteByQueryRequestParameters DefaultOperator(DefaultOperatorOptions default_operator) + public DeleteByQueryRequestParameters DefaultOperator(DefaultOperator default_operator) { this._default_operator = default_operator; this.AddQueryString("default_operator", this._default_operator); @@ -1621,9 +1621,9 @@ public DeleteByQueryRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public DeleteByQueryRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public DeleteByQueryRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -1631,9 +1631,9 @@ public DeleteByQueryRequestParameters ExpandWildcards(ExpandWildcardsOptions exp } - internal ReplicationOptions _replication { get; set; } + internal Replication _replication { get; set; } ///Specific replication type - public DeleteByQueryRequestParameters Replication(ReplicationOptions replication) + public DeleteByQueryRequestParameters Replication(Replication replication) { this._replication = replication; this.AddQueryString("replication", this._replication); @@ -1771,9 +1771,9 @@ public ExplainRequestParameters Analyzer(string analyzer) } - internal DefaultOperatorOptions _default_operator { get; set; } + internal DefaultOperator _default_operator { get; set; } ///The default operator for query string query (AND or OR) - public ExplainRequestParameters DefaultOperator(DefaultOperatorOptions default_operator) + public ExplainRequestParameters DefaultOperator(DefaultOperator default_operator) { this._default_operator = default_operator; this.AddQueryString("default_operator", this._default_operator); @@ -2011,9 +2011,9 @@ public GetRequestParameters Version(long version) } - internal VersionTypeOptions _version_type { get; set; } + internal VersionType _version_type { get; set; } ///Specific version type - public GetRequestParameters VersionType(VersionTypeOptions version_type) + public GetRequestParameters VersionType(VersionType version_type) { this._version_type = version_type; this.AddQueryString("version_type", this._version_type); @@ -2121,9 +2121,9 @@ public SourceRequestParameters Version(long version) } - internal VersionTypeOptions _version_type { get; set; } + internal VersionType _version_type { get; set; } ///Specific version type - public SourceRequestParameters VersionType(VersionTypeOptions version_type) + public SourceRequestParameters VersionType(VersionType version_type) { this._version_type = version_type; this.AddQueryString("version_type", this._version_type); @@ -2141,9 +2141,9 @@ public SourceRequestParameters VersionType(VersionTypeOptions version_type) public class IndexRequestParameters : FluentRequestParameters { - internal ConsistencyOptions _consistency { get; set; } + internal Consistency _consistency { get; set; } ///Explicit write consistency setting for the operation - public IndexRequestParameters Consistency(ConsistencyOptions consistency) + public IndexRequestParameters Consistency(Consistency consistency) { this._consistency = consistency; this.AddQueryString("consistency", this._consistency); @@ -2151,9 +2151,9 @@ public IndexRequestParameters Consistency(ConsistencyOptions consistency) } - internal OpTypeOptions _op_type { get; set; } + internal OpType _op_type { get; set; } ///Explicit operation type - public IndexRequestParameters OpType(OpTypeOptions op_type) + public IndexRequestParameters OpType(OpType op_type) { this._op_type = op_type; this.AddQueryString("op_type", this._op_type); @@ -2181,9 +2181,9 @@ public IndexRequestParameters Refresh(bool refresh) } - internal ReplicationOptions _replication { get; set; } + internal Replication _replication { get; set; } ///Specific replication type - public IndexRequestParameters Replication(ReplicationOptions replication) + public IndexRequestParameters Replication(Replication replication) { this._replication = replication; this.AddQueryString("replication", this._replication); @@ -2241,9 +2241,9 @@ public IndexRequestParameters Version(long version) } - internal VersionTypeOptions _version_type { get; set; } + internal VersionType _version_type { get; set; } ///Specific version type - public IndexRequestParameters VersionType(VersionTypeOptions version_type) + public IndexRequestParameters VersionType(VersionType version_type) { this._version_type = version_type; this.AddQueryString("version_type", this._version_type); @@ -2341,9 +2341,9 @@ public AnalyzeRequestParameters Tokenizer(string tokenizer) } - internal FormatOptions _format { get; set; } + internal Format _format { get; set; } ///Format of the output - public AnalyzeRequestParameters Format(FormatOptions format) + public AnalyzeRequestParameters Format(Format format) { this._format = format; this.AddQueryString("format", this._format); @@ -2451,9 +2451,9 @@ public ClearCacheRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public ClearCacheRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public ClearCacheRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -2531,9 +2531,9 @@ public CloseIndexRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public CloseIndexRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public CloseIndexRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -2731,9 +2731,9 @@ public IndexExistsRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public IndexExistsRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public IndexExistsRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -2781,9 +2781,9 @@ public IndicesExistsAliasRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public IndicesExistsAliasRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public IndicesExistsAliasRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -2851,9 +2851,9 @@ public IndicesExistsTypeRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public IndicesExistsTypeRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public IndicesExistsTypeRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -2921,9 +2921,9 @@ public FlushRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public FlushRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public FlushRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -2961,9 +2961,9 @@ public GetAliasesRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public GetAliasesRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public GetAliasesRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -3051,9 +3051,9 @@ public IndicesGetFieldMappingRequestParameters AllowNoIndices(bool allow_no_indi } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public IndicesGetFieldMappingRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public IndicesGetFieldMappingRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -3101,9 +3101,9 @@ public GetMappingRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public GetMappingRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public GetMappingRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -3151,9 +3151,9 @@ public GetIndexSettingsRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public GetIndexSettingsRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public GetIndexSettingsRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -3241,9 +3241,9 @@ public GetWarmerRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public GetWarmerRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public GetWarmerRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -3311,9 +3311,9 @@ public OpenIndexRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public OpenIndexRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public OpenIndexRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -3361,9 +3361,9 @@ public OptimizeRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public OptimizeRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public OptimizeRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -3511,9 +3511,9 @@ public PutMappingRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public PutMappingRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public PutMappingRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -3561,9 +3561,9 @@ public UpdateSettingsRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public UpdateSettingsRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public UpdateSettingsRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -3661,9 +3661,9 @@ public PutWarmerRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both, in the search request to warm. - public PutWarmerRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public PutWarmerRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -3741,9 +3741,9 @@ public RefreshRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public RefreshRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public RefreshRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -3801,9 +3801,9 @@ public SegmentsRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public SegmentsRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public SegmentsRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -3891,9 +3891,9 @@ public IndicesStatsRequestParameters Human(bool human) } - internal LevelOptions _level { get; set; } + internal Level _level { get; set; } ///Return stats aggregated at cluster, index or shard level - public IndicesStatsRequestParameters Level(LevelOptions level) + public IndicesStatsRequestParameters Level(Level level) { this._level = level; this.AddQueryString("level", this._level); @@ -3941,9 +3941,9 @@ public IndicesStatusRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public IndicesStatusRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public IndicesStatusRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -4061,9 +4061,9 @@ public ValidateQueryRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public ValidateQueryRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public ValidateQueryRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -4431,9 +4431,9 @@ public MpercolateRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public MpercolateRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public MpercolateRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -4451,9 +4451,9 @@ public MpercolateRequestParameters ExpandWildcards(ExpandWildcardsOptions expand public class MultiSearchRequestParameters : FluentRequestParameters { - internal SearchTypeOptions _search_type { get; set; } + internal SearchType _search_type { get; set; } ///Search operation type - public MultiSearchRequestParameters SearchType(SearchTypeOptions search_type) + public MultiSearchRequestParameters SearchType(SearchType search_type) { this._search_type = search_type; this.AddQueryString("search_type", this._search_type); @@ -4601,12 +4601,12 @@ public NodesHotThreadsRequestParameters Threads(long threads) } - internal TypeOptions _type { get; set; } + internal ThreadType _thread_type { get; set; } ///The type to sample (default: cpu) - public NodesHotThreadsRequestParameters Type(TypeOptions type) + public NodesHotThreadsRequestParameters ThreadType(ThreadType thread_type) { - this._type = type; - this.AddQueryString("type", this._type); + this._thread_type = thread_type; + this.AddQueryString("thread_type", this._thread_type); return this; } @@ -4731,9 +4731,9 @@ public NodesStatsRequestParameters Human(bool human) } - internal LevelOptions _level { get; set; } + internal Level _level { get; set; } ///Return indices stats aggregated at node, index or shard level - public NodesStatsRequestParameters Level(LevelOptions level) + public NodesStatsRequestParameters Level(Level level) { this._level = level; this.AddQueryString("level", this._level); @@ -4801,9 +4801,9 @@ public PercolateRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public PercolateRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public PercolateRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -4841,9 +4841,9 @@ public PercolateRequestParameters Version(long version) } - internal VersionTypeOptions _version_type { get; set; } + internal VersionType _version_type { get; set; } ///Specific version type - public PercolateRequestParameters VersionType(VersionTypeOptions version_type) + public PercolateRequestParameters VersionType(VersionType version_type) { this._version_type = version_type; this.AddQueryString("version_type", this._version_type); @@ -4921,9 +4921,9 @@ public SearchRequestParameters AnalyzeWildcard(bool analyze_wildcard) } - internal DefaultOperatorOptions _default_operator { get; set; } + internal DefaultOperator _default_operator { get; set; } ///The default operator for query string query (AND or OR) - public SearchRequestParameters DefaultOperator(DefaultOperatorOptions default_operator) + public SearchRequestParameters DefaultOperator(DefaultOperator default_operator) { this._default_operator = default_operator; this.AddQueryString("default_operator", this._default_operator); @@ -4961,9 +4961,9 @@ public SearchRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public SearchRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public SearchRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -5031,9 +5031,9 @@ public SearchRequestParameters Scroll(string scroll) } - internal SearchTypeOptions _search_type { get; set; } + internal SearchType _search_type { get; set; } ///Search operation type - public SearchRequestParameters SearchType(SearchTypeOptions search_type) + public SearchRequestParameters SearchType(SearchType search_type) { this._search_type = search_type; this.AddQueryString("search_type", this._search_type); @@ -5071,9 +5071,9 @@ public SearchRequestParameters SuggestField(string suggest_field) } - internal SuggestModeOptions _suggest_mode { get; set; } + internal SuggestMode _suggest_mode { get; set; } ///Specify suggest mode - public SearchRequestParameters SuggestMode(SuggestModeOptions suggest_mode) + public SearchRequestParameters SuggestMode(SuggestMode suggest_mode) { this._suggest_mode = suggest_mode; this.AddQueryString("suggest_mode", this._suggest_mode); @@ -5161,9 +5161,9 @@ public SearchShardsRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public SearchShardsRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public SearchShardsRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -5201,9 +5201,9 @@ public SearchTemplateRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public SearchTemplateRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public SearchTemplateRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -5241,9 +5241,9 @@ public SearchTemplateRequestParameters Scroll(string scroll) } - internal SearchTypeOptions _search_type { get; set; } + internal SearchType _search_type { get; set; } ///Search operation type - public SearchTemplateRequestParameters SearchType(SearchTypeOptions search_type) + public SearchTemplateRequestParameters SearchType(SearchType search_type) { this._search_type = search_type; this.AddQueryString("search_type", this._search_type); @@ -5491,9 +5491,9 @@ public SuggestRequestParameters AllowNoIndices(bool allow_no_indices) } - internal ExpandWildcardsOptions _expand_wildcards { get; set; } + internal ExpandWildcards _expand_wildcards { get; set; } ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public SuggestRequestParameters ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public SuggestRequestParameters ExpandWildcards(ExpandWildcards expand_wildcards) { this._expand_wildcards = expand_wildcards; this.AddQueryString("expand_wildcards", this._expand_wildcards); @@ -5641,9 +5641,9 @@ public TermvectorRequestParameters Parent(string parent) public class UpdateRequestParameters : FluentRequestParameters { - internal ConsistencyOptions _consistency { get; set; } + internal Consistency _consistency { get; set; } ///Explicit write consistency setting for the operation - public UpdateRequestParameters Consistency(ConsistencyOptions consistency) + public UpdateRequestParameters Consistency(Consistency consistency) { this._consistency = consistency; this.AddQueryString("consistency", this._consistency); @@ -5691,9 +5691,9 @@ public UpdateRequestParameters Refresh(bool refresh) } - internal ReplicationOptions _replication { get; set; } + internal Replication _replication { get; set; } ///Specific replication type - public UpdateRequestParameters Replication(ReplicationOptions replication) + public UpdateRequestParameters Replication(Replication replication) { this._replication = replication; this.AddQueryString("replication", this._replication); @@ -5771,9 +5771,9 @@ public UpdateRequestParameters Version(long version) } - internal VersionTypeOptions _version_type { get; set; } + internal VersionType _version_type { get; set; } ///Specific version type - public UpdateRequestParameters VersionType(VersionTypeOptions version_type) + public UpdateRequestParameters VersionType(VersionType version_type) { this._version_type = version_type; this.AddQueryString("version_type", this._version_type); diff --git a/src/Nest/DSL/Bulk/BulkCreateDescriptor.cs b/src/Nest/DSL/Bulk/BulkCreateDescriptor.cs index 9001133e50d..e0292654811 100644 --- a/src/Nest/DSL/Bulk/BulkCreateDescriptor.cs +++ b/src/Nest/DSL/Bulk/BulkCreateDescriptor.cs @@ -92,7 +92,7 @@ public BulkCreateDescriptor VersionType(string versionType) return this; } - public BulkCreateDescriptor VersionType(VersionTypeOptions versionType) + public BulkCreateDescriptor VersionType(VersionType versionType) { this._VersionType = versionType.GetStringValue(); return this; diff --git a/src/Nest/DSL/Bulk/BulkDeleteDescriptor.cs b/src/Nest/DSL/Bulk/BulkDeleteDescriptor.cs index d5023e30aae..b05c2519453 100644 --- a/src/Nest/DSL/Bulk/BulkDeleteDescriptor.cs +++ b/src/Nest/DSL/Bulk/BulkDeleteDescriptor.cs @@ -92,7 +92,7 @@ public BulkDeleteDescriptor VersionType(string versionType) return this; } - public BulkDeleteDescriptor VersionType(VersionTypeOptions versionType) + public BulkDeleteDescriptor VersionType(VersionType versionType) { this._VersionType = versionType.GetStringValue(); return this; diff --git a/src/Nest/DSL/Bulk/BulkIndexDescriptor.cs b/src/Nest/DSL/Bulk/BulkIndexDescriptor.cs index c602bec78f2..92f3e0bbe76 100644 --- a/src/Nest/DSL/Bulk/BulkIndexDescriptor.cs +++ b/src/Nest/DSL/Bulk/BulkIndexDescriptor.cs @@ -92,7 +92,7 @@ public BulkIndexDescriptor VersionType(string versionType) return this; } - public BulkIndexDescriptor VersionType(VersionTypeOptions versionType) + public BulkIndexDescriptor VersionType(VersionType versionType) { this._VersionType = versionType.GetStringValue(); return this; diff --git a/src/Nest/DSL/Bulk/BulkUpdateDescriptor.cs b/src/Nest/DSL/Bulk/BulkUpdateDescriptor.cs index 39239e8c911..b7850450527 100644 --- a/src/Nest/DSL/Bulk/BulkUpdateDescriptor.cs +++ b/src/Nest/DSL/Bulk/BulkUpdateDescriptor.cs @@ -168,7 +168,7 @@ public BulkUpdateDescriptor VersionType(string versionType) } - public BulkUpdateDescriptor VersionType(VersionTypeOptions versionType) + public BulkUpdateDescriptor VersionType(VersionType versionType) { this._VersionType = versionType.GetStringValue(); return this; diff --git a/src/Nest/DSL/SearchDescriptor.cs b/src/Nest/DSL/SearchDescriptor.cs index 3046cec6f88..0df8fdfb46f 100644 --- a/src/Nest/DSL/SearchDescriptor.cs +++ b/src/Nest/DSL/SearchDescriptor.cs @@ -105,7 +105,7 @@ public interface ISearchRequest: IRequest string _Routing { get; } - SearchTypeOptions? _SearchType { get; } + SearchType? _SearchType { get; } Func, Type> TypeSelector { get; set;} @@ -141,9 +141,9 @@ public class SearchRequest : BaseRequest, ISearchReques public IHighlightRequest Highlight { get; set; } public IDictionary Aggregations { get; set; } - SearchTypeOptions? ISearchRequest._SearchType + SearchType? ISearchRequest._SearchType { - get { return this.QueryString.GetQueryStringValue("search_type"); } + get { return this.QueryString.GetQueryStringValue("search_type"); } } string ISearchRequest._Preference @@ -190,9 +190,9 @@ public partial class SearchDescriptor : BasePathDescriptor("search_type"); } + get { return this.Request.RequestParameters.GetQueryStringValue("search_type"); } } SearchRequestParameters ISearchRequest.QueryString diff --git a/src/Nest/DSL/Suggest/DirectGeneratorDescriptor.cs b/src/Nest/DSL/Suggest/DirectGeneratorDescriptor.cs index e932f95b6d6..aab057b3d9c 100644 --- a/src/Nest/DSL/Suggest/DirectGeneratorDescriptor.cs +++ b/src/Nest/DSL/Suggest/DirectGeneratorDescriptor.cs @@ -23,7 +23,7 @@ public interface IDirectGenerator [JsonProperty(PropertyName = "suggest_mode")] [JsonConverter(typeof(StringEnumConverter))] - SuggestModeOptions? SuggestMode { get; set; } + SuggestMode? SuggestMode { get; set; } [JsonProperty(PropertyName = "min_word_len")] int? MinWordLen { get; set; } @@ -52,7 +52,7 @@ public class DirectGenerator : IDirectGenerator public PropertyPathMarker Field { get; set; } public int? Size { get; set; } public int? PrefixLen { get; set; } - public SuggestModeOptions? SuggestMode { get; set; } + public SuggestMode? SuggestMode { get; set; } public int? MinWordLen { get; set; } public int? MaxEdits { get; set; } public decimal? MaxInspections { get; set; } @@ -72,7 +72,7 @@ public class DirectGeneratorDescriptor : IDirectGenerator where T : class int? IDirectGenerator.PrefixLen { get; set; } - SuggestModeOptions? IDirectGenerator.SuggestMode { get; set; } + SuggestMode? IDirectGenerator.SuggestMode { get; set; } int? IDirectGenerator.MinWordLen { get; set; } @@ -106,7 +106,7 @@ public DirectGeneratorDescriptor Size(int size) return this; } - public DirectGeneratorDescriptor SuggestMode(SuggestModeOptions mode) + public DirectGeneratorDescriptor SuggestMode(SuggestMode mode) { Self.SuggestMode = mode; return this; diff --git a/src/Nest/DSL/Suggest/TermSuggestDescriptor.cs b/src/Nest/DSL/Suggest/TermSuggestDescriptor.cs index bd5ebfc86ef..f0419158d4d 100644 --- a/src/Nest/DSL/Suggest/TermSuggestDescriptor.cs +++ b/src/Nest/DSL/Suggest/TermSuggestDescriptor.cs @@ -17,7 +17,7 @@ public interface ITermSuggester : ISuggester [JsonProperty(PropertyName = "suggest_mode")] [JsonConverter(typeof(StringEnumConverter))] - SuggestModeOptions? SuggestMode { get; set; } + SuggestMode? SuggestMode { get; set; } [JsonProperty(PropertyName = "min_word_len")] int? MinWordLen { get; set; } @@ -38,7 +38,7 @@ public interface ITermSuggester : ISuggester public class TermSuggester : Suggester, ITermSuggester { public int? PrefixLen { get; set; } - public SuggestModeOptions? SuggestMode { get; set; } + public SuggestMode? SuggestMode { get; set; } public int? MinWordLen { get; set; } public int? MaxEdits { get; set; } public int? MaxInspections { get; set; } @@ -52,7 +52,7 @@ public class TermSuggestDescriptor : BaseSuggestDescriptor, ITermSuggester int? ITermSuggester.PrefixLen { get; set; } - SuggestModeOptions? ITermSuggester.SuggestMode { get; set; } + SuggestMode? ITermSuggester.SuggestMode { get; set; } int? ITermSuggester.MinWordLen { get; set; } @@ -100,7 +100,7 @@ public TermSuggestDescriptor ShardSize(int size) return this; } - public TermSuggestDescriptor SuggestMode(SuggestModeOptions mode) + public TermSuggestDescriptor SuggestMode(SuggestMode mode) { Self.SuggestMode = mode; return this; diff --git a/src/Nest/DSL/_Descriptors.generated.cs b/src/Nest/DSL/_Descriptors.generated.cs index 8bbae4c8197..d9a9f6ae93c 100644 --- a/src/Nest/DSL/_Descriptors.generated.cs +++ b/src/Nest/DSL/_Descriptors.generated.cs @@ -41,7 +41,7 @@ public partial class BulkDescriptor ///Explicit write consistency setting for the operation - public BulkDescriptor Consistency(ConsistencyOptions consistency) + public BulkDescriptor Consistency(Consistency consistency) { this.Request.RequestParameters.Consistency(consistency); return this; @@ -57,7 +57,7 @@ public BulkDescriptor Refresh(bool refresh = true) ///Explicitely set the replication type - public BulkDescriptor Replication(ReplicationOptions replication) + public BulkDescriptor Replication(Replication replication) { this.Request.RequestParameters.Replication(replication); return this; @@ -161,7 +161,7 @@ public partial class CatAllocationDescriptor : BaseRequestThe unit in which to display byte values - public CatAllocationDescriptor Bytes(BytesOptions bytes) + public CatAllocationDescriptor Bytes(Bytes bytes) { this.Request.RequestParameters.Bytes(bytes); return this; @@ -287,7 +287,7 @@ public partial class CatFielddataDescriptor : BaseRequestThe unit in which to display byte values - public CatFielddataDescriptor Bytes(BytesOptions bytes) + public CatFielddataDescriptor Bytes(Bytes bytes) { this.Request.RequestParameters.Bytes(bytes); return this; @@ -467,7 +467,7 @@ public partial class CatIndicesDescriptor : BaseRequestThe unit in which to display byte values - public CatIndicesDescriptor Bytes(BytesOptions bytes) + public CatIndicesDescriptor Bytes(Bytes bytes) { this.Request.RequestParameters.Bytes(bytes); return this; @@ -778,7 +778,7 @@ public partial class CatRecoveryDescriptor : BaseRequestThe unit in which to display byte values - public CatRecoveryDescriptor Bytes(BytesOptions bytes) + public CatRecoveryDescriptor Bytes(Bytes bytes) { this.Request.RequestParameters.Bytes(bytes); return this; @@ -1013,7 +1013,7 @@ public partial class ClusterHealthDescriptor ///Specify the level of detail for returned information - public ClusterHealthDescriptor Level(LevelOptions level) + public ClusterHealthDescriptor Level(Level level) { this.Request.RequestParameters.Level(level); return this; @@ -1069,7 +1069,7 @@ public ClusterHealthDescriptor WaitForRelocatingShards(long wait_for_relocating_ ///Wait until cluster is in a specific state - public ClusterHealthDescriptor WaitForStatus(WaitForStatusOptions wait_for_status) + public ClusterHealthDescriptor WaitForStatus(WaitForStatus wait_for_status) { this.Request.RequestParameters.WaitForStatus(wait_for_status); return this; @@ -1293,7 +1293,7 @@ public CountDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public CountDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public CountDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -1378,7 +1378,7 @@ public PercolateCountDescriptor AllowNoIndices(bool allow_no_indices = true ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public PercolateCountDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public PercolateCountDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -1410,7 +1410,7 @@ public PercolateCountDescriptor Version(long version) ///Specific version type - public PercolateCountDescriptor VersionType(VersionTypeOptions version_type) + public PercolateCountDescriptor VersionType(VersionType version_type) { this.Request.RequestParameters.VersionType(version_type); return this; @@ -1431,7 +1431,7 @@ public partial class DeleteDescriptor ///Specific write consistency setting for the operation - public DeleteDescriptor Consistency(ConsistencyOptions consistency) + public DeleteDescriptor Consistency(Consistency consistency) { this.Request.RequestParameters.Consistency(consistency); return this; @@ -1455,7 +1455,7 @@ public DeleteDescriptor Refresh(bool refresh = true) ///Specific replication type - public DeleteDescriptor Replication(ReplicationOptions replication) + public DeleteDescriptor Replication(Replication replication) { this.Request.RequestParameters.Replication(replication); return this; @@ -1487,7 +1487,7 @@ public DeleteDescriptor Version(long version) ///Specific version type - public DeleteDescriptor VersionType(VersionTypeOptions version_type) + public DeleteDescriptor VersionType(VersionType version_type) { this.Request.RequestParameters.VersionType(version_type); return this; @@ -1516,7 +1516,7 @@ public DeleteByQueryDescriptor Analyzer(string analyzer) ///Specific write consistency setting for the operation - public DeleteByQueryDescriptor Consistency(ConsistencyOptions consistency) + public DeleteByQueryDescriptor Consistency(Consistency consistency) { this.Request.RequestParameters.Consistency(consistency); return this; @@ -1524,7 +1524,7 @@ public DeleteByQueryDescriptor Consistency(ConsistencyOptions consistency) ///The default operator for query string query (AND or OR) - public DeleteByQueryDescriptor DefaultOperator(DefaultOperatorOptions default_operator) + public DeleteByQueryDescriptor DefaultOperator(DefaultOperator default_operator) { this.Request.RequestParameters.DefaultOperator(default_operator); return this; @@ -1556,7 +1556,7 @@ public DeleteByQueryDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public DeleteByQueryDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public DeleteByQueryDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -1564,7 +1564,7 @@ public DeleteByQueryDescriptor ExpandWildcards(ExpandWildcardsOptions expand_ ///Specific replication type - public DeleteByQueryDescriptor Replication(ReplicationOptions replication) + public DeleteByQueryDescriptor Replication(Replication replication) { this.Request.RequestParameters.Replication(replication); return this; @@ -1686,7 +1686,7 @@ public ExplainDescriptor Analyzer(string analyzer) ///The default operator for query string query (AND or OR) - public ExplainDescriptor DefaultOperator(DefaultOperatorOptions default_operator) + public ExplainDescriptor DefaultOperator(DefaultOperator default_operator) { this.Request.RequestParameters.DefaultOperator(default_operator); return this; @@ -1955,7 +1955,7 @@ public GetDescriptor Version(long version) ///Specific version type - public GetDescriptor VersionType(VersionTypeOptions version_type) + public GetDescriptor VersionType(VersionType version_type) { this.Request.RequestParameters.VersionType(version_type); return this; @@ -2070,7 +2070,7 @@ public SourceDescriptor Version(long version) ///Specific version type - public SourceDescriptor VersionType(VersionTypeOptions version_type) + public SourceDescriptor VersionType(VersionType version_type) { this.Request.RequestParameters.VersionType(version_type); return this; @@ -2091,7 +2091,7 @@ public partial class IndexDescriptor ///Explicit write consistency setting for the operation - public IndexDescriptor Consistency(ConsistencyOptions consistency) + public IndexDescriptor Consistency(Consistency consistency) { this.Request.RequestParameters.Consistency(consistency); return this; @@ -2099,7 +2099,7 @@ public IndexDescriptor Consistency(ConsistencyOptions consistency) ///Explicit operation type - public IndexDescriptor OpType(OpTypeOptions op_type) + public IndexDescriptor OpType(OpType op_type) { this.Request.RequestParameters.OpType(op_type); return this; @@ -2123,7 +2123,7 @@ public IndexDescriptor Refresh(bool refresh = true) ///Specific replication type - public IndexDescriptor Replication(ReplicationOptions replication) + public IndexDescriptor Replication(Replication replication) { this.Request.RequestParameters.Replication(replication); return this; @@ -2171,7 +2171,7 @@ public IndexDescriptor Version(long version) ///Specific version type - public IndexDescriptor VersionType(VersionTypeOptions version_type) + public IndexDescriptor VersionType(VersionType version_type) { this.Request.RequestParameters.VersionType(version_type); return this; @@ -2265,7 +2265,7 @@ public AnalyzeDescriptor Tokenizer(string tokenizer) ///Format of the output - public AnalyzeDescriptor Format(FormatOptions format) + public AnalyzeDescriptor Format(Format format) { this.Request.RequestParameters.Format(format); return this; @@ -2369,7 +2369,7 @@ public ClearCacheDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public ClearCacheDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public ClearCacheDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -2438,7 +2438,7 @@ public CloseIndexDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public CloseIndexDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public CloseIndexDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -2639,7 +2639,7 @@ public IndexExistsDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public IndexExistsDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public IndexExistsDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -2684,7 +2684,7 @@ public IndicesExistsAliasDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public IndicesExistsAliasDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public IndicesExistsAliasDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -2762,7 +2762,7 @@ public IndicesExistsTypeDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public IndicesExistsTypeDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public IndicesExistsTypeDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -2829,7 +2829,7 @@ public FlushDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public FlushDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public FlushDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -2866,7 +2866,7 @@ public GetAliasesDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public GetAliasesDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public GetAliasesDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -2954,7 +2954,7 @@ public IndicesGetFieldMappingDescriptor AllowNoIndices(bool allow_no_indices = t ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public IndicesGetFieldMappingDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public IndicesGetFieldMappingDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -3005,7 +3005,7 @@ public GetMappingDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public GetMappingDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public GetMappingDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -3050,7 +3050,7 @@ public GetIndexSettingsDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public GetIndexSettingsDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public GetIndexSettingsDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -3132,7 +3132,7 @@ public GetWarmerDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public GetWarmerDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public GetWarmerDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -3193,7 +3193,7 @@ public OpenIndexDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public OpenIndexDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public OpenIndexDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -3238,7 +3238,7 @@ public OptimizeDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public OptimizeDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public OptimizeDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -3374,7 +3374,7 @@ public PutMappingDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public PutMappingDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public PutMappingDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -3419,7 +3419,7 @@ public UpdateSettingsDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public UpdateSettingsDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public UpdateSettingsDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -3509,7 +3509,7 @@ public PutWarmerDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both, in the search request to warm. - public PutWarmerDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public PutWarmerDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -3589,7 +3589,7 @@ public RefreshDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public RefreshDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public RefreshDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -3642,7 +3642,7 @@ public SegmentsDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public SegmentsDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public SegmentsDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -3752,7 +3752,7 @@ public IndicesStatsDescriptor Human(bool human = true) ///Return stats aggregated at cluster, index or shard level - public IndicesStatsDescriptor Level(LevelOptions level) + public IndicesStatsDescriptor Level(Level level) { this.Request.RequestParameters.Level(level); return this; @@ -3797,7 +3797,7 @@ public IndicesStatusDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public IndicesStatusDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public IndicesStatusDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -3903,7 +3903,7 @@ public ValidateQueryDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public ValidateQueryDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public ValidateQueryDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -4274,7 +4274,7 @@ public MpercolateDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public MpercolateDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public MpercolateDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -4301,7 +4301,7 @@ public partial class MultiSearchDescriptor ///Search operation type - public MultiSearchDescriptor SearchType(SearchTypeOptions search_type) + public MultiSearchDescriptor SearchType(SearchType search_type) { this.Request.RequestParameters.SearchType(search_type); return this; @@ -4442,9 +4442,9 @@ public NodesHotThreadsDescriptor Threads(long threads) ///The type to sample (default: cpu) - public NodesHotThreadsDescriptor TypeQueryString(TypeOptions type) + public NodesHotThreadsDescriptor ThreadType(ThreadType thread_type) { - this.Request.RequestParameters.Type(type); + this.Request.RequestParameters.ThreadType(thread_type); return this; } @@ -4606,7 +4606,7 @@ public NodesStatsDescriptor Human(bool human = true) ///Return indices stats aggregated at node, index or shard level - public NodesStatsDescriptor Level(LevelOptions level) + public NodesStatsDescriptor Level(Level level) { this.Request.RequestParameters.Level(level); return this; @@ -4667,7 +4667,7 @@ public PercolateDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public PercolateDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public PercolateDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -4699,7 +4699,7 @@ public PercolateDescriptor Version(long version) ///Specific version type - public PercolateDescriptor VersionType(VersionTypeOptions version_type) + public PercolateDescriptor VersionType(VersionType version_type) { this.Request.RequestParameters.VersionType(version_type); return this; @@ -4784,7 +4784,7 @@ public SearchDescriptor AnalyzeWildcard(bool analyze_wildcard = true) ///The default operator for query string query (AND or OR) - public SearchDescriptor DefaultOperator(DefaultOperatorOptions default_operator) + public SearchDescriptor DefaultOperator(DefaultOperator default_operator) { this.Request.RequestParameters.DefaultOperator(default_operator); return this; @@ -4816,7 +4816,7 @@ public SearchDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public SearchDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public SearchDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -4872,7 +4872,7 @@ public SearchDescriptor Scroll(string scroll) ///Search operation type - public SearchDescriptor SearchType(SearchTypeOptions search_type) + public SearchDescriptor SearchType(SearchType search_type) { this.Request.RequestParameters.SearchType(search_type); return this; @@ -4913,7 +4913,7 @@ public SearchDescriptor SuggestField(Expression> typedPathLoo ///Specify suggest mode - public SearchDescriptor SuggestMode(SuggestModeOptions suggest_mode) + public SearchDescriptor SuggestMode(SuggestMode suggest_mode) { this.Request.RequestParameters.SuggestMode(suggest_mode); return this; @@ -4990,7 +4990,7 @@ public SearchShardsDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public SearchShardsDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public SearchShardsDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -5033,7 +5033,7 @@ public SearchTemplateDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public SearchTemplateDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public SearchTemplateDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -5065,7 +5065,7 @@ public SearchTemplateDescriptor Scroll(string scroll) ///Search operation type - public SearchTemplateDescriptor SearchType(SearchTypeOptions search_type) + public SearchTemplateDescriptor SearchType(SearchType search_type) { this.Request.RequestParameters.SearchType(search_type); return this; @@ -5328,7 +5328,7 @@ public SuggestDescriptor AllowNoIndices(bool allow_no_indices = true) ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public SuggestDescriptor ExpandWildcards(ExpandWildcardsOptions expand_wildcards) + public SuggestDescriptor ExpandWildcards(ExpandWildcards expand_wildcards) { this.Request.RequestParameters.ExpandWildcards(expand_wildcards); return this; @@ -5469,7 +5469,7 @@ public partial class UpdateDescriptor ///Explicit write consistency setting for the operation - public UpdateDescriptor Consistency(ConsistencyOptions consistency) + public UpdateDescriptor Consistency(Consistency consistency) { this.Request.RequestParameters.Consistency(consistency); return this; @@ -5520,7 +5520,7 @@ public UpdateDescriptor Refresh(bool refresh = true) ///Specific replication type - public UpdateDescriptor Replication(ReplicationOptions replication) + public UpdateDescriptor Replication(Replication replication) { this.Request.RequestParameters.Replication(replication); return this; @@ -5584,7 +5584,7 @@ public UpdateDescriptor Version(long version) ///Specific version type - public UpdateDescriptor VersionType(VersionTypeOptions version_type) + public UpdateDescriptor VersionType(VersionType version_type) { this.Request.RequestParameters.VersionType(version_type); return this; diff --git a/src/Nest/Domain/Responses/ReindexObservable.cs b/src/Nest/Domain/Responses/ReindexObservable.cs index 210c166c00e..8c8e9ad89c5 100644 --- a/src/Nest/Domain/Responses/ReindexObservable.cs +++ b/src/Nest/Domain/Responses/ReindexObservable.cs @@ -58,7 +58,7 @@ private void Reindex(IObserver> observer) .From(0) .Take(100) .Query(this._reindexDescriptor._QuerySelector ?? (q=>q.MatchAll())) - .SearchType(SearchTypeOptions.Scan) + .SearchType(SearchType.Scan) .Scroll(scroll) ); if (searchResult.Total <= 0) diff --git a/src/Nest/ExposedInternals/NestSerializer.cs b/src/Nest/ExposedInternals/NestSerializer.cs index 48a407b5972..905c51d839a 100644 --- a/src/Nest/ExposedInternals/NestSerializer.cs +++ b/src/Nest/ExposedInternals/NestSerializer.cs @@ -179,21 +179,7 @@ protected string GetSearchType(ISearchRequest descriptor, MultiSearchDescriptor { if (descriptor._SearchType != null) { - switch (descriptor._SearchType.Value) - { - case SearchTypeOptions.Count: - return "count"; - case SearchTypeOptions.DfsQueryThenFetch: - return "dfs_query_then_fetch"; - case SearchTypeOptions.DfsQueryAndFetch: - return "dfs_query_and_fetch"; - case SearchTypeOptions.QueryThenFetch: - return "query_then_fetch"; - case SearchTypeOptions.QueryAndFetch: - return "query_and_fetch"; - case SearchTypeOptions.Scan: - return "scan"; - } + return descriptor._SearchType.Value.GetStringValue(); } IRequest request = multiSearchDescriptor; return request.RequestParameters.GetQueryStringValue("search_type"); diff --git a/src/Tests/Nest.Tests.Integration/Cluster/HealthTests.cs b/src/Tests/Nest.Tests.Integration/Cluster/HealthTests.cs index dd94d01d71c..190e121c59e 100644 --- a/src/Tests/Nest.Tests.Integration/Cluster/HealthTests.cs +++ b/src/Tests/Nest.Tests.Integration/Cluster/HealthTests.cs @@ -9,32 +9,32 @@ public class HealthTests : IntegrationTests [Test] public void ClusterHealth() { - var r = this._client.ClusterHealth(h=>h.Level(LevelOptions.Cluster)); + var r = this._client.ClusterHealth(h=>h.Level(Level.Cluster)); Assert.True(r.IsValid); } [Test] public void ClusterHealthPerIndex() { - var r = this._client.ClusterHealth(h=>h.Index(ElasticsearchConfiguration.DefaultIndex).Level(LevelOptions.Cluster)); + var r = this._client.ClusterHealth(h=>h.Index(ElasticsearchConfiguration.DefaultIndex).Level(Level.Cluster)); Assert.True(r.IsValid); } [Test] public void IndexHealth() { - var r = this._client.ClusterHealth(h=>h.Level(LevelOptions.Indices)); + var r = this._client.ClusterHealth(h=>h.Level(Level.Indices)); Assert.True(r.IsValid); } [Test] public void ShardHealth() { - var r = this._client.ClusterHealth(h=>h.Level(LevelOptions.Shards)); + var r = this._client.ClusterHealth(h=>h.Level(Level.Shards)); Assert.True(r.IsValid); } [Test] public void DetailedHealth() { var r = this._client.ClusterHealth(h => h - .Level(LevelOptions.Shards) + .Level(Level.Shards) .Timeout("30s") .WaitForNodes("1") .WaitForRelocatingShards(0) @@ -46,7 +46,7 @@ public void DetailedHealthPerIndex() { var r = this._client.ClusterHealth(h => h .Indices(ElasticsearchConfiguration.DefaultIndex) - .Level(LevelOptions.Shards) + .Level(Level.Shards) .Timeout("30s") .WaitForNodes("1") .WaitForRelocatingShards(0) diff --git a/src/Tests/Nest.Tests.Integration/ConnectionTests.cs b/src/Tests/Nest.Tests.Integration/ConnectionTests.cs index 0bdac4cdba1..1f8f4e421b6 100644 --- a/src/Tests/Nest.Tests.Integration/ConnectionTests.cs +++ b/src/Tests/Nest.Tests.Integration/ConnectionTests.cs @@ -93,7 +93,7 @@ public void ConnectUsingRawClient() public void ConnectUsingRawClientComplexCall() { var result = this._client.Raw.ClusterHealth(s => s - .Level(LevelOptions.Indices) + .Level(Level.Indices) .Local(true) .WaitForActiveShards(1) ); diff --git a/src/Tests/Nest.Tests.Integration/Core/ClearScroll/ClearScrollTests.cs b/src/Tests/Nest.Tests.Integration/Core/ClearScroll/ClearScrollTests.cs index 350c2722462..cab507624aa 100644 --- a/src/Tests/Nest.Tests.Integration/Core/ClearScroll/ClearScrollTests.cs +++ b/src/Tests/Nest.Tests.Integration/Core/ClearScroll/ClearScrollTests.cs @@ -13,7 +13,7 @@ public class ClearScrollTests : IntegrationTests [Test] public void ClearScroll() { - var searchResults = this._client.Search(s => s.Scroll("1m").SearchType(SearchTypeOptions.Scan)); + var searchResults = this._client.Search(s => s.Scroll("1m").SearchType(SearchType.Scan)); var validScrollId = searchResults.ScrollId; validScrollId.Should().NotBeNullOrWhiteSpace(); diff --git a/src/Tests/Nest.Tests.Integration/Core/DeleteTests.cs b/src/Tests/Nest.Tests.Integration/Core/DeleteTests.cs index c937e2918e2..1dcb9ba7c80 100644 --- a/src/Tests/Nest.Tests.Integration/Core/DeleteTests.cs +++ b/src/Tests/Nest.Tests.Integration/Core/DeleteTests.cs @@ -205,7 +205,7 @@ public void RemoveAllByPassingAsIEnumerableOfBulkParameters() Assert.Greater(totalSet, 0); var totalResults = result.Total; - var deleteResult = this._client.Bulk(b=>b.DeleteMany(result.Documents, (p, o) => p.VersionType(VersionTypeOptions.Internal)).Refresh()); + var deleteResult = this._client.Bulk(b=>b.DeleteMany(result.Documents, (p, o) => p.VersionType(VersionType.Internal)).Refresh()); Assert.True(deleteResult.IsValid, deleteResult.ConnectionStatus.ResponseRaw.Utf8String()); Assert.False(deleteResult.Errors, deleteResult.ConnectionStatus.ResponseRaw.Utf8String()); diff --git a/src/Tests/Nest.Tests.Integration/Core/IndexTests.cs b/src/Tests/Nest.Tests.Integration/Core/IndexTests.cs index 03196c337b7..c87e9d9b8c6 100644 --- a/src/Tests/Nest.Tests.Integration/Core/IndexTests.cs +++ b/src/Tests/Nest.Tests.Integration/Core/IndexTests.cs @@ -27,7 +27,7 @@ public void IndexUsingCreateFlag() }; // Index the document - var indexResult = this._client.Index(doc, i => i.OpType(OpTypeOptions.Create)); + var indexResult = this._client.Index(doc, i => i.OpType(OpType.Create)); indexResult.IsValid.Should().BeTrue(); // Grab the indexed document. @@ -41,7 +41,7 @@ public void IndexUsingCreateFlag() Assert.AreEqual(doc.Name, foundDoc.Name); // Now try to index the document again while using the Create Flag - var response = this._client.Index(doc, i => i.OpType(OpTypeOptions.Create)); + var response = this._client.Index(doc, i => i.OpType(OpType.Create)); // Make sure the index request failed with HTTP status 409 since document with same id already exists. Assert.False(response.Created); @@ -61,7 +61,7 @@ public void IndexUsingCreateFlagOnNoRawResponseClient() }; // Index the document - var indexResult = this._clientNoRawResponse.Index(doc, i => i.OpType(OpTypeOptions.Create)); + var indexResult = this._clientNoRawResponse.Index(doc, i => i.OpType(OpType.Create)); indexResult.IsValid.Should().BeTrue(); // Grab the indexed document. @@ -75,7 +75,7 @@ public void IndexUsingCreateFlagOnNoRawResponseClient() Assert.AreEqual(doc.Name, foundDoc.Name); // Now try to index the document again while using the Create Flag - var response = this._clientNoRawResponse.Index(doc, i => i.OpType(OpTypeOptions.Create)); + var response = this._clientNoRawResponse.Index(doc, i => i.OpType(OpType.Create)); // Make sure the index request failed with HTTP status 409 since document with same id already exists. Assert.False(response.Created); diff --git a/src/Tests/Nest.Tests.Integration/Core/MultiSearch/MultiSearchTests.cs b/src/Tests/Nest.Tests.Integration/Core/MultiSearch/MultiSearchTests.cs index 3a9916ab273..efbdb696074 100644 --- a/src/Tests/Nest.Tests.Integration/Core/MultiSearch/MultiSearchTests.cs +++ b/src/Tests/Nest.Tests.Integration/Core/MultiSearch/MultiSearchTests.cs @@ -85,7 +85,7 @@ public void MultiSearchShouldReturnErrorProperty() .MatchAll() .Preference("_primary") .Routing("customvalue1") - .SearchType(SearchTypeOptions.DfsQueryAndFetch)) + .SearchType(SearchType.DfsQueryAndFetch)) .Search(s => s.Query(q=>q.Term("THIS FIELD DOES NOT EXIST", "BOOM"))) ); var status = result.ConnectionStatus; diff --git a/src/Tests/Nest.Tests.Integration/Core/Suggest/SuggestTests.cs b/src/Tests/Nest.Tests.Integration/Core/Suggest/SuggestTests.cs index 1a347c5d0c7..e283e407b12 100644 --- a/src/Tests/Nest.Tests.Integration/Core/Suggest/SuggestTests.cs +++ b/src/Tests/Nest.Tests.Integration/Core/Suggest/SuggestTests.cs @@ -18,7 +18,7 @@ public void TestSuggest() var suggestResults = _client.Suggest(s => s .Term("mySuggest", m => m - .SuggestMode(SuggestModeOptions.Always) + .SuggestMode(SuggestMode.Always) .Text(wrongCountry) .Size(1) .OnField("country") diff --git a/src/Tests/Nest.Tests.Integration/Nest.Tests.Integration.csproj b/src/Tests/Nest.Tests.Integration/Nest.Tests.Integration.csproj index 6be03e3083d..9e7f36ab596 100644 --- a/src/Tests/Nest.Tests.Integration/Nest.Tests.Integration.csproj +++ b/src/Tests/Nest.Tests.Integration/Nest.Tests.Integration.csproj @@ -92,9 +92,9 @@ - - + + @@ -203,9 +203,9 @@ - - - + + + diff --git a/src/Tests/Nest.Tests.Integration/Search/QueryDSLTests.cs b/src/Tests/Nest.Tests.Integration/Search/QueryDSLTests.cs index f023ee632c8..8e393cf7e80 100644 --- a/src/Tests/Nest.Tests.Integration/Search/QueryDSLTests.cs +++ b/src/Tests/Nest.Tests.Integration/Search/QueryDSLTests.cs @@ -143,7 +143,7 @@ public void TermSuggest() var results = this._client.Search(s => s .Query(q => q.MatchAll()) - .SuggestTerm("mySuggest", m => m.SuggestMode(SuggestModeOptions.Always).Text(wrongCountry).Size(1).OnField("country")) + .SuggestTerm("mySuggest", m => m.SuggestMode(SuggestMode.Always).Text(wrongCountry).Size(1).OnField("country")) ); Assert.NotNull(results); diff --git a/src/Tests/Nest.Tests.Integration/Search/Scroll/ScrollTests.cs b/src/Tests/Nest.Tests.Integration/Search/Scroll/ScrollTests.cs index b7f031ab9f2..e886b1272d7 100644 --- a/src/Tests/Nest.Tests.Integration/Search/Scroll/ScrollTests.cs +++ b/src/Tests/Nest.Tests.Integration/Search/Scroll/ScrollTests.cs @@ -18,7 +18,7 @@ public void SearchTypeScan() .Size(1) .MatchAll() .Fields(f => f.Name) - .SearchType(SearchTypeOptions.Scan) + .SearchType(SearchType.Scan) .Scroll("2s") ); Assert.True(scanResults.IsValid); @@ -52,7 +52,7 @@ public void SearchTypeScanMoreThanOne() .Size(20) .MatchAll() .Fields(f => f.Name) - .SearchType(SearchTypeOptions.Scan) + .SearchType(SearchType.Scan) .Scroll("4s") ); Assert.True(scanResults.IsValid); diff --git a/src/Tests/Nest.Tests.Integration/Search/SearchType/SearchTypeCountTests.cs b/src/Tests/Nest.Tests.Integration/Search/SearchTypeTests/SearchTypeCountTests.cs similarity index 86% rename from src/Tests/Nest.Tests.Integration/Search/SearchType/SearchTypeCountTests.cs rename to src/Tests/Nest.Tests.Integration/Search/SearchTypeTests/SearchTypeCountTests.cs index afb5d4648a0..ec237d179fb 100644 --- a/src/Tests/Nest.Tests.Integration/Search/SearchType/SearchTypeCountTests.cs +++ b/src/Tests/Nest.Tests.Integration/Search/SearchTypeTests/SearchTypeCountTests.cs @@ -4,7 +4,7 @@ using Nest.Tests.MockData.Domain; using NUnit.Framework; -namespace Nest.Tests.Integration.Search.SearchType +namespace Nest.Tests.Integration.Search.SearchTypeTests { [TestFixture] public class SearchTypeCountTests : IntegrationTests @@ -19,7 +19,7 @@ public void SearchTypeCount() .Size(10) .MatchAll() .Fields(f=>f.Name) - .SearchType(SearchTypeOptions.Count) + .SearchType(SearchType.Count) ); Assert.True(queryResults.IsValid); Assert.False(queryResults.Documents.Any()); diff --git a/src/Tests/Nest.Tests.Integration/Search/SearchType/SearchTypeScanTests.cs b/src/Tests/Nest.Tests.Integration/Search/SearchTypeTests/SearchTypeScanTests.cs similarity index 91% rename from src/Tests/Nest.Tests.Integration/Search/SearchType/SearchTypeScanTests.cs rename to src/Tests/Nest.Tests.Integration/Search/SearchTypeTests/SearchTypeScanTests.cs index dc3317b43c9..85e824ec7b3 100644 --- a/src/Tests/Nest.Tests.Integration/Search/SearchType/SearchTypeScanTests.cs +++ b/src/Tests/Nest.Tests.Integration/Search/SearchTypeTests/SearchTypeScanTests.cs @@ -6,7 +6,7 @@ using Nest.Tests.MockData.Domain; using NUnit.Framework; -namespace Nest.Tests.Integration.Search.SearchType +namespace Nest.Tests.Integration.Search.SearchTypeTests { [TestFixture] public class SearchTypeScanTests : IntegrationTests @@ -21,7 +21,7 @@ public void SearchTypeScanWithoutScrollIsInvalid() .Size(10) .MatchAll() .Fields(f=>f.Name) - .SearchType(SearchTypeOptions.Scan) + .SearchType(SearchType.Scan) ); Assert.False(queryResults.IsValid); var e = queryResults.ConnectionStatus.OriginalException as ElasticsearchServerException; @@ -36,7 +36,7 @@ public void SearchTypeScan() .Size(10) .MatchAll() .Fields(f => f.Name) - .SearchType(SearchTypeOptions.Scan) + .SearchType(SearchType.Scan) .Scroll("2s") ); Assert.True(queryResults.IsValid); diff --git a/src/Tests/Nest.Tests.Integration/Search/SearchType/SearchTypeTests.cs b/src/Tests/Nest.Tests.Integration/Search/SearchTypeTests/SearchTypeTests.cs similarity index 84% rename from src/Tests/Nest.Tests.Integration/Search/SearchType/SearchTypeTests.cs rename to src/Tests/Nest.Tests.Integration/Search/SearchTypeTests/SearchTypeTests.cs index bb6844d1430..2c3064a3ea0 100644 --- a/src/Tests/Nest.Tests.Integration/Search/SearchType/SearchTypeTests.cs +++ b/src/Tests/Nest.Tests.Integration/Search/SearchTypeTests/SearchTypeTests.cs @@ -4,7 +4,7 @@ using Nest.Tests.MockData.Domain; using NUnit.Framework; -namespace Nest.Tests.Integration.Search.SearchType +namespace Nest.Tests.Integration.Search.SearchTypeTests { [TestFixture] public class SearchTypeTests : IntegrationTests @@ -19,7 +19,7 @@ public void SearchQueryAndFetch() .Size(10) .MatchAll() .Fields(f=>f.Name) - .SearchType(SearchTypeOptions.QueryAndFetch) + .SearchType(SearchType.QueryAndFetch) ); Assert.True(queryResults.IsValid); @@ -33,7 +33,7 @@ public void SearchQueryThenFetch() .Size(10) .MatchAll() .Fields(f => f.Name) - .SearchType(SearchTypeOptions.QueryThenFetch) + .SearchType(SearchType.QueryThenFetch) ); Assert.True(queryResults.IsValid); @@ -48,7 +48,7 @@ public void SearchDfsQueryAndFetch() .Size(10) .MatchAll() .Fields(f => f.Name) - .SearchType(SearchTypeOptions.DfsQueryAndFetch) + .SearchType(SearchType.DfsQueryAndFetch) ); Assert.True(queryResults.IsValid); @@ -62,7 +62,7 @@ public void SearchDfsQueryThenFetch() .Size(10) .MatchAll() .Fields(f => f.Name) - .SearchType(SearchTypeOptions.DfsQueryThenFetch) + .SearchType(SearchType.DfsQueryThenFetch) ); Assert.True(queryResults.IsValid); diff --git a/src/Tests/Nest.Tests.Integration/Search/SubClassSupport/SubClassSupportTests.cs b/src/Tests/Nest.Tests.Integration/Search/SubClassSupport/SubClassSupportTests.cs index a1bf0402489..932418aba59 100644 --- a/src/Tests/Nest.Tests.Integration/Search/SubClassSupport/SubClassSupportTests.cs +++ b/src/Tests/Nest.Tests.Integration/Search/SubClassSupport/SubClassSupportTests.cs @@ -1,12 +1,10 @@ using System; using System.Linq; +using Elasticsearch.Net; using FluentAssertions; -using Nest.Tests.MockData; -using Nest.Tests.MockData.Domain; using NUnit.Framework; -using Elasticsearch.Net; -namespace Nest.Tests.Integration.Search.SearchType +namespace Nest.Tests.Integration.Search.SubClassSupport { [TestFixture] public class SubClassSupportTests : IntegrationTests diff --git a/src/Tests/Nest.Tests.Unit/BigBadUrlUnitTests.cs b/src/Tests/Nest.Tests.Unit/BigBadUrlUnitTests.cs index 54874678168..0ac97f71c56 100644 --- a/src/Tests/Nest.Tests.Unit/BigBadUrlUnitTests.cs +++ b/src/Tests/Nest.Tests.Unit/BigBadUrlUnitTests.cs @@ -98,7 +98,7 @@ public void TestAllTheUrls() Do("GET", "/_template/mytemplate", c => c.GetTemplate("mytemplate")); Do("GET", "/_all/_warmer/mywarmer", c => c.GetWarmer("mywarmer")); Do("GET", "/mycustomindex/_warmer/mywarmer", c => c.GetWarmer("mywarmer", g => g.Index("mycustomindex"))); - Do("GET", "/_cluster/health?level=indices", c => c.ClusterHealth(h => h.Level(LevelOptions.Indices))); + Do("GET", "/_cluster/health?level=indices", c => c.ClusterHealth(h => h.Level(Level.Indices))); Do("GET", "/_cluster/health", c => c.ClusterHealth()); Do("PUT", "/mydefaultindex/doc/2", c => c.Index(new Doc { Id = "2" })); Do("POST", "/mydefaultindex/doc", c => c.Index(new Doc { Name = "2" })); diff --git a/src/Tests/Nest.Tests.Unit/Cluster/HealthTests.cs b/src/Tests/Nest.Tests.Unit/Cluster/HealthTests.cs index ad89dc868ac..02926269cb7 100644 --- a/src/Tests/Nest.Tests.Unit/Cluster/HealthTests.cs +++ b/src/Tests/Nest.Tests.Unit/Cluster/HealthTests.cs @@ -11,7 +11,7 @@ public class HealthTests : BaseJsonTests [Test] public void ClusterHealth() { - var r = this._client.ClusterHealth(h=>h.Level(LevelOptions.Cluster)); + var r = this._client.ClusterHealth(h=>h.Level(Level.Cluster)); var u = new Uri(r.ConnectionStatus.RequestUrl); u.AbsolutePath.Should().StartWith("/_cluster/health"); u.Query.Should().Contain("level=cluster"); @@ -19,7 +19,7 @@ public void ClusterHealth() [Test] public void ClusterHealthPerIndex() { - var r = this._client.ClusterHealth(h=>h.Index(UnitTestDefaults.DefaultIndex).Level(LevelOptions.Cluster)); + var r = this._client.ClusterHealth(h=>h.Index(UnitTestDefaults.DefaultIndex).Level(Level.Cluster)); var u = new Uri(r.ConnectionStatus.RequestUrl); u.AbsolutePath.Should().StartWith("/_cluster/health/nest_test_data"); u.Query.Should().Contain("level=cluster"); @@ -27,7 +27,7 @@ public void ClusterHealthPerIndex() [Test] public void IndexHealth() { - var r = this._client.ClusterHealth(h=>h.Level(LevelOptions.Indices)); + var r = this._client.ClusterHealth(h=>h.Level(Level.Indices)); var u = new Uri(r.ConnectionStatus.RequestUrl); u.AbsolutePath.Should().StartWith("/_cluster/health"); u.Query.Should().Contain("level=indices"); @@ -35,7 +35,7 @@ public void IndexHealth() [Test] public void ShardHealth() { - var r = this._client.ClusterHealth(h=>h.Level(LevelOptions.Shards)); + var r = this._client.ClusterHealth(h=>h.Level(Level.Shards)); var u = new Uri(r.ConnectionStatus.RequestUrl); u.AbsolutePath.Should().StartWith("/_cluster/health"); u.Query.Should().Contain("level=shards"); @@ -44,11 +44,11 @@ public void ShardHealth() public void DetailedHealth() { var r = this._client.ClusterHealth(h=>h - .Level(LevelOptions.Shards) + .Level(Level.Shards) .Timeout("30s") .WaitForNodes("1") .WaitForRelocatingShards(0) - .WaitForStatus(WaitForStatusOptions.Green) + .WaitForStatus(WaitForStatus.Green) ); var u = new Uri(r.ConnectionStatus.RequestUrl); u.AbsolutePath.Should().StartWith("/_cluster/health"); diff --git a/src/Tests/Nest.Tests.Unit/Core/Bulk/BulkTests.cs b/src/Tests/Nest.Tests.Unit/Core/Bulk/BulkTests.cs index 5dc9b91fe1e..163e3f33388 100644 --- a/src/Tests/Nest.Tests.Unit/Core/Bulk/BulkTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/Bulk/BulkTests.cs @@ -16,16 +16,16 @@ public void BulkOperations() var result = this._client.Bulk(b => b .Index(i => i .Object(new ElasticsearchProject {Id = 2}) - .VersionType(VersionTypeOptions.Force)) + .VersionType(VersionType.Force)) .Create(i => i .Object(new ElasticsearchProject { Id = 3 }) - .VersionType(VersionTypeOptions.Internal)) + .VersionType(VersionType.Internal)) .Delete(i => i .Object(new ElasticsearchProject { Id = 4 }) - .VersionType(VersionTypeOptions.ExternalGte)) + .VersionType(VersionType.ExternalGte)) .Update(i => i .Object(new ElasticsearchProject { Id = 3 }) - .VersionType(VersionTypeOptions.External) + .VersionType(VersionType.External) .Document(new { name = "NEST"}) ) ); diff --git a/src/Tests/Nest.Tests.Unit/Core/Bulk/BulkUrlTests.cs b/src/Tests/Nest.Tests.Unit/Core/Bulk/BulkUrlTests.cs index 49150f736e2..7b63784414b 100644 --- a/src/Tests/Nest.Tests.Unit/Core/Bulk/BulkUrlTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/Bulk/BulkUrlTests.cs @@ -27,7 +27,7 @@ public void BulkNonFixedWithParams() { var result = this._client.Bulk(b => b .Refresh() - .Consistency(ConsistencyOptions.Quorum) + .Consistency(Consistency.Quorum) .Index(i => i.Object(new ElasticsearchProject {Id = 2})) .Create(i => i.Object(new ElasticsearchProject { Id = 3 })) .Delete(i => i.Object(new ElasticsearchProject { Id = 4 })) diff --git a/src/Tests/Nest.Tests.Unit/Core/Domain/Connection/ConnectionTests.cs b/src/Tests/Nest.Tests.Unit/Core/Domain/Connection/ConnectionTests.cs index 2d36ece9d01..9f4a9bd67c6 100644 --- a/src/Tests/Nest.Tests.Unit/Core/Domain/Connection/ConnectionTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/Domain/Connection/ConnectionTests.cs @@ -57,7 +57,7 @@ public void SendStringAsJsonBody() { var jsonAsString = "{ \"json_as_a_string\" : true}"; var result = this._client.Raw.Bulk(jsonAsString, qs => qs - .Replication(ReplicationOptions.Async) + .Replication(Replication.Async) .Refresh(true) ); StringAssert.EndsWith(":9200/_bulk?replication=async&refresh=true", result.RequestUrl); @@ -71,7 +71,7 @@ public void SendAnonymousObjectAsJsonBody() var result = this._client.Raw.Bulk( new { json_as_a_string = true } , qs => qs - .Replication(ReplicationOptions.Async) + .Replication(Replication.Async) .Refresh(true) ); StringAssert.EndsWith(":9200/_bulk?replication=async&refresh=true", result.RequestUrl); diff --git a/src/Tests/Nest.Tests.Unit/Core/MoreLikeThis/MltUrlTests.cs b/src/Tests/Nest.Tests.Unit/Core/MoreLikeThis/MltUrlTests.cs index 85e8a77e08b..91c61aa201b 100644 --- a/src/Tests/Nest.Tests.Unit/Core/MoreLikeThis/MltUrlTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/MoreLikeThis/MltUrlTests.cs @@ -71,7 +71,7 @@ public void SetSearchUrlOptions() .Id(1) .MltFields(p => p.Country, p => p.Content) .Search(s => s - .SearchType(SearchTypeOptions.DfsQueryAndFetch) + .SearchType(SearchType.DfsQueryAndFetch) .Scroll("5m") ) ); diff --git a/src/Tests/Nest.Tests.Unit/Core/MultiSearch/MultiSearchTests.cs b/src/Tests/Nest.Tests.Unit/Core/MultiSearch/MultiSearchTests.cs index e8a3ec1d6fb..3307583ffd1 100644 --- a/src/Tests/Nest.Tests.Unit/Core/MultiSearch/MultiSearchTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/MultiSearch/MultiSearchTests.cs @@ -64,11 +64,11 @@ public void MultiSearchRespectsSearchTypePreferenceAndRouting() .MatchAll() .Preference("_primary") .Routing("customvalue1") - .SearchType(SearchTypeOptions.DfsQueryAndFetch)) + .SearchType(SearchType.DfsQueryAndFetch)) .Search(s => s.MatchAll() .Preference("_primary_first") .Routing("customvalue2") - .SearchType(SearchTypeOptions.Count)) + .SearchType(SearchType.Count)) ); var status = result.ConnectionStatus; var uri = new Uri(result.ConnectionStatus.RequestUrl); diff --git a/src/Tests/Nest.Tests.Unit/Core/Versioning/VersioningTests.cs b/src/Tests/Nest.Tests.Unit/Core/Versioning/VersioningTests.cs index 95e865fb4de..9507ff6d403 100644 --- a/src/Tests/Nest.Tests.Unit/Core/Versioning/VersioningTests.cs +++ b/src/Tests/Nest.Tests.Unit/Core/Versioning/VersioningTests.cs @@ -61,7 +61,7 @@ public void IndexOpTypeDefault() public void IndexOpTypeCreate() { var o = new ElasticsearchProject { Id = 1, Name = "Test" }; - var result = this._client.Index(o, i => i.OpType(OpTypeOptions.Create)); + var result = this._client.Index(o, i => i.OpType(OpType.Create)); var status = result.ConnectionStatus; StringAssert.Contains("op_type=create", status.RequestUrl); } diff --git a/src/Tests/Nest.Tests.Unit/Nest.Tests.Unit.csproj b/src/Tests/Nest.Tests.Unit/Nest.Tests.Unit.csproj index 93e5e244173..d92c38e5559 100644 --- a/src/Tests/Nest.Tests.Unit/Nest.Tests.Unit.csproj +++ b/src/Tests/Nest.Tests.Unit/Nest.Tests.Unit.csproj @@ -374,7 +374,7 @@ - + @@ -950,7 +950,7 @@ Always - + Always diff --git a/src/Tests/Nest.Tests.Unit/Search/SearchType/ScriptFieldTests.cs b/src/Tests/Nest.Tests.Unit/Search/SearchTypeTests/ScriptFieldTests.cs similarity index 67% rename from src/Tests/Nest.Tests.Unit/Search/SearchType/ScriptFieldTests.cs rename to src/Tests/Nest.Tests.Unit/Search/SearchTypeTests/ScriptFieldTests.cs index ad1c26262dd..392c93975d6 100644 --- a/src/Tests/Nest.Tests.Unit/Search/SearchType/ScriptFieldTests.cs +++ b/src/Tests/Nest.Tests.Unit/Search/SearchTypeTests/ScriptFieldTests.cs @@ -3,17 +3,11 @@ using System.Linq; using System.Text; using Elasticsearch.Net; -using NUnit.Framework; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - using Nest; -using Newtonsoft.Json.Converters; -using Nest.Resolvers.Converters; using Nest.Tests.MockData.Domain; -using Nest.Resolvers; +using NUnit.Framework; -namespace Nest.Tests.Unit.Search.SearchType +namespace Nest.Tests.Unit.Search.SearchTypeTests { [TestFixture] public class SearchTypeTests : BaseJsonTests @@ -25,7 +19,7 @@ public void SearchTypeDoesNotPolluteQueryObject() .From(0) .Size(10) .MatchAll() - .SearchType(SearchTypeOptions.QueryAndFetch); + .SearchType(SearchType.QueryAndFetch); this.JsonEquals(s, System.Reflection.MethodBase.GetCurrentMethod()); } diff --git a/src/Tests/Nest.Tests.Unit/Search/SearchType/SearchTypeDoesNotPolluteQueryObject.json b/src/Tests/Nest.Tests.Unit/Search/SearchTypeTests/SearchTypeDoesNotPolluteQueryObject.json similarity index 100% rename from src/Tests/Nest.Tests.Unit/Search/SearchType/SearchTypeDoesNotPolluteQueryObject.json rename to src/Tests/Nest.Tests.Unit/Search/SearchTypeTests/SearchTypeDoesNotPolluteQueryObject.json diff --git a/src/Tests/Nest.Tests.Unit/Search/suggest/PhraseSuggestTests.cs b/src/Tests/Nest.Tests.Unit/Search/suggest/PhraseSuggestTests.cs index 3e074e4c4e1..68ef3c08abf 100644 --- a/src/Tests/Nest.Tests.Unit/Search/suggest/PhraseSuggestTests.cs +++ b/src/Tests/Nest.Tests.Unit/Search/suggest/PhraseSuggestTests.cs @@ -35,7 +35,7 @@ public void PhraseSuggestDescriptorDirectGeneratorTest() { var phraseSuggestDescriptor = new PhraseSuggestDescriptor() .Analyzer("body") - .DirectGenerator(m => m.OnField("body").SuggestMode(SuggestModeOptions.Always).MinWordLength(3)); + .DirectGenerator(m => m.OnField("body").SuggestMode(SuggestMode.Always).MinWordLength(3)); var json = TestElasticClient.Serialize(phraseSuggestDescriptor); diff --git a/src/Tests/Nest.Tests.Unit/Search/suggest/TermSuggestTests.cs b/src/Tests/Nest.Tests.Unit/Search/suggest/TermSuggestTests.cs index d9740fd39d3..517ff7461b8 100644 --- a/src/Tests/Nest.Tests.Unit/Search/suggest/TermSuggestTests.cs +++ b/src/Tests/Nest.Tests.Unit/Search/suggest/TermSuggestTests.cs @@ -16,7 +16,7 @@ public void TermSuggestDescriptorTest() .MaxInspections(17) .OnField("field1") .Size(3) - .SuggestMode(SuggestModeOptions.Missing); + .SuggestMode(SuggestMode.Missing); var json = TestElasticClient.Serialize(termSuggestDescriptor); @@ -41,7 +41,7 @@ public void TermSuggestOnSearchTest() .MaxInspections(17) .OnField("field1") .Size(3) - .SuggestMode(SuggestModeOptions.Missing) + .SuggestMode(SuggestMode.Missing) ) ); diff --git a/src/Tests/Nest.Tests.Unit/Settings/UsePrettyResponseTests.cs b/src/Tests/Nest.Tests.Unit/Settings/UsePrettyResponseTests.cs index 6e8975165a0..26e4af2711f 100644 --- a/src/Tests/Nest.Tests.Unit/Settings/UsePrettyResponseTests.cs +++ b/src/Tests/Nest.Tests.Unit/Settings/UsePrettyResponseTests.cs @@ -17,7 +17,7 @@ public void UsePrettyResponsesShouldSurviveUrlModififications() var connection = new InMemoryConnection(settings); var client = new ElasticClient(settings, connection); - var r = client.ClusterHealth(h=>h.Level(LevelOptions.Cluster)); + var r = client.ClusterHealth(h=>h.Level(Level.Cluster)); var u = new Uri(r.ConnectionStatus.RequestUrl); u.AbsolutePath.Should().StartWith("/_cluster/health"); u.Query.Should().Contain("level=cluster"); From ac740359f0ba0a024cf8c456b7981efeb5493c3b Mon Sep 17 00:00:00 2001 From: gmarz Date: Thu, 26 Jun 2014 10:36:57 +0200 Subject: [PATCH 8/8] Delete unused file --- src/Nest/Enums/FacetTypes.cs | 9 --------- src/Nest/Nest.csproj | 1 - 2 files changed, 10 deletions(-) delete mode 100644 src/Nest/Enums/FacetTypes.cs diff --git a/src/Nest/Enums/FacetTypes.cs b/src/Nest/Enums/FacetTypes.cs deleted file mode 100644 index 682f358f650..00000000000 --- a/src/Nest/Enums/FacetTypes.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Nest -{ - -} diff --git a/src/Nest/Nest.csproj b/src/Nest/Nest.csproj index e2481d83e72..90c962e9fd8 100644 --- a/src/Nest/Nest.csproj +++ b/src/Nest/Nest.csproj @@ -795,7 +795,6 @@ -