diff --git a/src/CodeGeneration/DocGenerator/Buildalyzer/Environment/FrameworkEnvironment.cs b/src/CodeGeneration/DocGenerator/Buildalyzer/Environment/FrameworkEnvironment.cs index fb35028c684..e41be6f9088 100644 --- a/src/CodeGeneration/DocGenerator/Buildalyzer/Environment/FrameworkEnvironment.cs +++ b/src/CodeGeneration/DocGenerator/Buildalyzer/Environment/FrameworkEnvironment.cs @@ -32,8 +32,6 @@ namespace DocGenerator.Buildalyzer.Environment { internal class FrameworkEnvironment : BuildEnvironment { - private readonly bool _sdkProject; - public string ToolsPath { get; } public string ExtensionsPath { get; } public string SDKsPath { get; } diff --git a/src/Nest/Aggregations/Metric/TopHits/TopHitsAggregation.cs b/src/Nest/Aggregations/Metric/TopHits/TopHitsAggregation.cs index bbf470934b4..2cc0125a07e 100644 --- a/src/Nest/Aggregations/Metric/TopHits/TopHitsAggregation.cs +++ b/src/Nest/Aggregations/Metric/TopHits/TopHitsAggregation.cs @@ -124,6 +124,7 @@ public TopHitsAggregationDescriptor Highlight(Func, IH public TopHitsAggregationDescriptor ScriptFields(Func> scriptFieldsSelector) => Assign(a => a.ScriptFields = scriptFieldsSelector?.Invoke(new ScriptFieldsDescriptor())?.Value); + [Obsolete("Removed in NEST 6.x")] public TopHitsAggregationDescriptor FielddataFields(Func, IPromise> fields) => Assign(a => a.FielddataFields = fields?.Invoke(new FieldsDescriptor())?.Value); diff --git a/src/Nest/Document/Multiple/Bulk/BulkResponseItem/BulkDeleteResponseItem.cs b/src/Nest/Document/Multiple/Bulk/BulkResponseItem/BulkDeleteResponseItem.cs index d0cfbc1c063..bb4d1ca209d 100644 --- a/src/Nest/Document/Multiple/Bulk/BulkResponseItem/BulkDeleteResponseItem.cs +++ b/src/Nest/Document/Multiple/Bulk/BulkResponseItem/BulkDeleteResponseItem.cs @@ -10,7 +10,6 @@ public class BulkDeleteResponseItem : BulkResponseItemBase public override string Operation { get; internal set; } [JsonProperty("found")] - [Obsolete("Removed in 6.0.")] public bool Found { get; internal set; } } diff --git a/src/Nest/Indices/IndexSettings/IndexTemplates/PutIndexTemplate/PutIndexTemplateRequest.cs b/src/Nest/Indices/IndexSettings/IndexTemplates/PutIndexTemplate/PutIndexTemplateRequest.cs index a8288981f59..6e96f951510 100644 --- a/src/Nest/Indices/IndexSettings/IndexTemplates/PutIndexTemplate/PutIndexTemplateRequest.cs +++ b/src/Nest/Indices/IndexSettings/IndexTemplates/PutIndexTemplate/PutIndexTemplateRequest.cs @@ -43,6 +43,7 @@ public partial class PutIndexTemplateDescriptor public PutIndexTemplateDescriptor Version(int version) => Assign(a => a.Version = version); + [Obsolete("Removed in NEST 6.x.")] public PutIndexTemplateDescriptor Template(string template)=> Assign(a => a.Template = template); public PutIndexTemplateDescriptor Settings(Func> settingsSelector) => diff --git a/src/Nest/Mapping/Types/Properties.cs b/src/Nest/Mapping/Types/Properties.cs index c7b133a6af8..1fadbc49a6d 100644 --- a/src/Nest/Mapping/Types/Properties.cs +++ b/src/Nest/Mapping/Types/Properties.cs @@ -51,6 +51,7 @@ public partial interface IPropertiesDescriptor TReturnType Date(Func, IDateProperty> selector); TReturnType Boolean(Func, IBooleanProperty> selector); TReturnType Binary(Func, IBinaryProperty> selector); + [Obsolete("Removed in Elasticsearch 6.0, please consider using the ingest-attachment plugin.")] TReturnType Attachment(Func, IAttachmentProperty> selector); TReturnType Object(Func, IObjectProperty> selector) where TChild : class; @@ -99,6 +100,7 @@ public PropertiesDescriptor() : base(new Properties()) { } public PropertiesDescriptor Binary(Func, IBinaryProperty> selector) => SetProperty(selector); + [Obsolete("Removed in Elasticsearch 6.0, please consider using the ingest-attachment plugin.")] public PropertiesDescriptor Attachment(Func, IAttachmentProperty> selector) => SetProperty(selector); public PropertiesDescriptor Object(Func, IObjectProperty> selector) diff --git a/src/Nest/Mapping/Types/PropertyJsonConverter.cs b/src/Nest/Mapping/Types/PropertyJsonConverter.cs index 3c5995708ea..6f77f2d8af5 100644 --- a/src/Nest/Mapping/Types/PropertyJsonConverter.cs +++ b/src/Nest/Mapping/Types/PropertyJsonConverter.cs @@ -66,7 +66,9 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist case FieldType.GeoShape: return jObject.ToObject(); case FieldType.Attachment: +#pragma warning disable 618 return jObject.ToObject(); +#pragma warning restore 618 case FieldType.Completion: return jObject.ToObject(); case FieldType.TokenCount: diff --git a/src/Nest/Mapping/Visitor/IMappingVisitor.cs b/src/Nest/Mapping/Visitor/IMappingVisitor.cs index 615f2c0622c..d4339ce4c33 100644 --- a/src/Nest/Mapping/Visitor/IMappingVisitor.cs +++ b/src/Nest/Mapping/Visitor/IMappingVisitor.cs @@ -19,7 +19,9 @@ public interface IMappingVisitor void Visit(IIpProperty property); void Visit(IGeoPointProperty property); void Visit(IGeoShapeProperty property); +#pragma warning disable 618 void Visit(IAttachmentProperty property); +#pragma warning restore 618 void Visit(INumberProperty property); void Visit(ICompletionProperty property); void Visit(IMurmur3HashProperty property); @@ -64,7 +66,9 @@ public virtual void Visit(IGeoPointProperty property) { } public virtual void Visit(IGeoShapeProperty property) { } +#pragma warning disable 618 public virtual void Visit(IAttachmentProperty property) { } +#pragma warning restore 618 public virtual void Visit(ICompletionProperty property) { } diff --git a/src/Nest/Mapping/Visitor/IPropertyVisitor.cs b/src/Nest/Mapping/Visitor/IPropertyVisitor.cs index 77bd2568a8b..69eb940b0ea 100644 --- a/src/Nest/Mapping/Visitor/IPropertyVisitor.cs +++ b/src/Nest/Mapping/Visitor/IPropertyVisitor.cs @@ -17,7 +17,9 @@ public interface IPropertyVisitor void Visit(IObjectProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute); void Visit(IGeoPointProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute); void Visit(IGeoShapeProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute); +#pragma warning disable 618 void Visit(IAttachmentProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute); +#pragma warning restore 618 void Visit(ICompletionProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute); void Visit(IIpProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute); void Visit(IMurmur3HashProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute); diff --git a/src/Nest/Mapping/Visitor/MappingWalker.cs b/src/Nest/Mapping/Visitor/MappingWalker.cs index b72561ac30d..225559f3589 100644 --- a/src/Nest/Mapping/Visitor/MappingWalker.cs +++ b/src/Nest/Mapping/Visitor/MappingWalker.cs @@ -149,7 +149,9 @@ public void Accept(IProperties properties) }); break; case FieldType.Attachment: +#pragma warning disable 618 this.Visit(field, t => +#pragma warning restore 618 { this._visitor.Visit(t); this.Accept(t.Fields); diff --git a/src/Nest/Mapping/Visitor/NoopPropertyVisitor.cs b/src/Nest/Mapping/Visitor/NoopPropertyVisitor.cs index 8034f982e07..a8375d9ba38 100644 --- a/src/Nest/Mapping/Visitor/NoopPropertyVisitor.cs +++ b/src/Nest/Mapping/Visitor/NoopPropertyVisitor.cs @@ -36,9 +36,11 @@ public virtual void Visit(IIpProperty type, PropertyInfo propertyInfo, Elasticse { } +#pragma warning disable 618 public virtual void Visit(IAttachmentProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { } +#pragma warning restore 618 public virtual void Visit(IGeoPointProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute) { @@ -100,8 +102,10 @@ public void Visit(IProperty type, PropertyInfo propertyInfo, ElasticsearchProper if (type is IKeywordProperty keywordType) Visit(keywordType, propertyInfo, attribute); +#pragma warning disable 618 if (type is IAttachmentProperty attachmentType) Visit(attachmentType, propertyInfo, attribute); +#pragma warning restore 618 if (type is IGeoShapeProperty geoShapeType) Visit(geoShapeType, propertyInfo, attribute); diff --git a/src/Nest/Mapping/Visitor/PropertyWalker.cs b/src/Nest/Mapping/Visitor/PropertyWalker.cs index 74356eb74c0..3f2f1f6759c 100644 --- a/src/Nest/Mapping/Visitor/PropertyWalker.cs +++ b/src/Nest/Mapping/Visitor/PropertyWalker.cs @@ -140,7 +140,9 @@ private IProperty InferProperty(Type type) return new CompletionProperty(); if (type == typeof(Attachment)) +#pragma warning disable 618 return new AttachmentProperty(); +#pragma warning restore 618 if (type == typeof(DateRange)) return new DateRangeProperty(); diff --git a/src/Nest/QueryDsl/Abstractions/Container/IQueryContainer.cs b/src/Nest/QueryDsl/Abstractions/Container/IQueryContainer.cs index a42b967641b..5089180e5fc 100644 --- a/src/Nest/QueryDsl/Abstractions/Container/IQueryContainer.cs +++ b/src/Nest/QueryDsl/Abstractions/Container/IQueryContainer.cs @@ -131,6 +131,7 @@ public interface IQueryContainer [JsonProperty("function_score")] IFunctionScoreQuery FunctionScore { get; set; } + [Obsolete("Removed in NEST 6.x")] [JsonProperty("template")] ITemplateQuery Template { get; set; } @@ -143,6 +144,7 @@ public interface IQueryContainer [JsonProperty("geo_polygon")] IGeoPolygonQuery GeoPolygon { get; set; } + [Obsolete("Removed in NEST 6.x")] [JsonProperty("geo_distance_range")] IGeoDistanceRangeQuery GeoDistanceRange { get; set; } diff --git a/src/Nest/QueryDsl/Abstractions/Container/QueryContainer-Assignments.cs b/src/Nest/QueryDsl/Abstractions/Container/QueryContainer-Assignments.cs index 2ac5d0fbc1b..2ec62bdd2cf 100644 --- a/src/Nest/QueryDsl/Abstractions/Container/QueryContainer-Assignments.cs +++ b/src/Nest/QueryDsl/Abstractions/Container/QueryContainer-Assignments.cs @@ -44,11 +44,15 @@ public partial class QueryContainer : IQueryContainer, IDescriptor private IIndicesQuery _indices; #pragma warning restore 618 private IFunctionScoreQuery _functionScore; +#pragma warning disable 618 private ITemplateQuery _template; +#pragma warning restore 618 private IGeoBoundingBoxQuery _geoBoundingBox; private IGeoDistanceQuery _geoDistance; private IGeoPolygonQuery _geoPolygon; +#pragma warning disable 618 private IGeoDistanceRangeQuery _geoDistanceRange; +#pragma warning restore 618 private IGeoHashCellQuery _geoHashCell; private IScriptQuery _script; private IExistsQuery _exists; @@ -107,11 +111,15 @@ private T Set(T value) where T : IQuery IIndicesQuery IQueryContainer.Indices { get { return _indices; } set { _indices = Set(value); } } #pragma warning restore 618 IFunctionScoreQuery IQueryContainer.FunctionScore { get { return _functionScore; } set { _functionScore = Set(value); } } +#pragma warning disable 618 ITemplateQuery IQueryContainer.Template { get { return _template; } set { _template = Set(value); } } +#pragma warning restore 618 IGeoBoundingBoxQuery IQueryContainer.GeoBoundingBox { get { return _geoBoundingBox; } set { _geoBoundingBox = Set(value); } } IGeoDistanceQuery IQueryContainer.GeoDistance { get { return _geoDistance; } set { _geoDistance = Set(value); } } IGeoPolygonQuery IQueryContainer.GeoPolygon { get { return _geoPolygon; } set { _geoPolygon = Set(value); } } +#pragma warning disable 618 IGeoDistanceRangeQuery IQueryContainer.GeoDistanceRange { get { return _geoDistanceRange; } set { _geoDistanceRange = Set(value); } } +#pragma warning restore 618 IGeoHashCellQuery IQueryContainer.GeoHashCell { get { return _geoHashCell; } set { _geoHashCell = Set(value); } } IScriptQuery IQueryContainer.Script { get { return _script; } set { _script = Set(value); } } IExistsQuery IQueryContainer.Exists { get { return _exists; } set { _exists = Set(value); } } diff --git a/src/Nest/QueryDsl/Abstractions/Container/QueryContainerDescriptor.cs b/src/Nest/QueryDsl/Abstractions/Container/QueryContainerDescriptor.cs index 925355c6299..4c91a8a2db3 100644 --- a/src/Nest/QueryDsl/Abstractions/Container/QueryContainerDescriptor.cs +++ b/src/Nest/QueryDsl/Abstractions/Container/QueryContainerDescriptor.cs @@ -245,6 +245,7 @@ public QueryContainer GeoHashCell(Func, IGeoHashCe /// Matches documents with a geo_point type field to include only those /// that exist within a specific distance range from a given geo_point /// + [Obsolete("Scheduled to be removed in 6.0")] public QueryContainer GeoDistanceRange(Func, IGeoDistanceRangeQuery> selector) => WrapInContainer(selector, (query, container) => container.GeoDistanceRange = query); diff --git a/src/Nest/QueryDsl/Compound/Bool/BoolQuery.cs b/src/Nest/QueryDsl/Compound/Bool/BoolQuery.cs index a1700ea8134..3072b4ea08b 100644 --- a/src/Nest/QueryDsl/Compound/Bool/BoolQuery.cs +++ b/src/Nest/QueryDsl/Compound/Bool/BoolQuery.cs @@ -56,7 +56,14 @@ public interface IBoolQuery : IQuery public class BoolQuery : QueryBase, IBoolQuery { - internal static bool Locked(IBoolQuery q) => !q.Name.IsNullOrEmpty() || q.Boost.HasValue || q.DisableCoord.HasValue || q.MinimumShouldMatch != null; + internal static bool Locked(IBoolQuery q) => + !q.Name.IsNullOrEmpty() || + q.Boost.HasValue || +#pragma warning disable 618 + q.DisableCoord.HasValue || +#pragma warning restore 618 + q.MinimumShouldMatch != null; + bool IBoolQuery.Locked => BoolQuery.Locked(this); private IList _must; diff --git a/src/Nest/QueryDsl/FullText/QueryString/QueryStringQuery.cs b/src/Nest/QueryDsl/FullText/QueryString/QueryStringQuery.cs index 0a117015752..85702fd2e65 100644 --- a/src/Nest/QueryDsl/FullText/QueryString/QueryStringQuery.cs +++ b/src/Nest/QueryDsl/FullText/QueryString/QueryStringQuery.cs @@ -260,6 +260,7 @@ public QueryStringQueryDescriptor EnablePositionIncrements(bool? enablePositi public QueryStringQueryDescriptor AnalyzeWildcard(bool? analyzeWildcard = true) => Assign(a => a.AnalyzeWildcard = analyzeWildcard); + [Obsolete("Removed in NEST 6.x.")] public QueryStringQueryDescriptor AutoGeneratePhraseQueries(bool? autoGeneratePhraseQueries = true) => Assign(a => a.AutoGeneratePhraseQueries = autoGeneratePhraseQueries); @@ -298,6 +299,7 @@ public QueryStringQueryDescriptor QuoteFieldSuffix(string quoteFieldSuffix) = public QueryStringQueryDescriptor Escape(bool? escape = true) => Assign(a => a.Escape = escape); + [Obsolete("Removed in NEST 6.x.")] public QueryStringQueryDescriptor AllFields(bool? allFields = true) => Assign(a => a.AllFields = allFields); [Obsolete("Removed in NEST 6.x.")] diff --git a/src/Nest/QueryDsl/Geo/Distance/GeoDistanceQuery.cs b/src/Nest/QueryDsl/Geo/Distance/GeoDistanceQuery.cs index 563d3c484a5..35e6db94830 100644 --- a/src/Nest/QueryDsl/Geo/Distance/GeoDistanceQuery.cs +++ b/src/Nest/QueryDsl/Geo/Distance/GeoDistanceQuery.cs @@ -14,6 +14,7 @@ public interface IGeoDistanceQuery : IFieldNameQuery Distance Distance { get; set; } [JsonProperty("optimize_bbox")] + [Obsolete("Scheduled to be removed in 6.0")] GeoOptimizeBBox? OptimizeBoundingBox { get; set; } [JsonProperty("distance_type")] @@ -64,6 +65,7 @@ public class GeoDistanceQueryDescriptor GeoLocation IGeoDistanceQuery.Location { get; set; } Distance IGeoDistanceQuery.Distance { get; set; } GeoDistanceType? IGeoDistanceQuery.DistanceType { get; set; } + [Obsolete("Scheduled to be removed in 6.0")] GeoOptimizeBBox? IGeoDistanceQuery.OptimizeBoundingBox { get; set; } bool? IGeoDistanceQuery.Coerce { get; set; } bool? IGeoDistanceQuery.IgnoreMalformed { get; set; } diff --git a/src/Nest/QueryDsl/Query.cs b/src/Nest/QueryDsl/Query.cs index 8c0f301e77b..769646c004b 100644 --- a/src/Nest/QueryDsl/Query.cs +++ b/src/Nest/QueryDsl/Query.cs @@ -1,7 +1,7 @@ -using System; -using System.Linq.Expressions; - -namespace Nest +using System; +using System.Linq.Expressions; + +namespace Nest { public static class Query where T : class { @@ -41,6 +41,7 @@ public static QueryContainer GeoBoundingBox(Func, IGeoDistanceQuery> selector) => new QueryContainerDescriptor().GeoDistance(selector); + [Obsolete("Scheduled to be removed in 6.0")] public static QueryContainer GeoDistanceRange(Func, IGeoDistanceRangeQuery> selector) => new QueryContainerDescriptor().GeoDistanceRange(selector); @@ -117,16 +118,16 @@ public static QueryContainer Nested(Func, INestedQuery> public static QueryContainer ParentId(Func, IParentIdQuery> selector) => new QueryContainerDescriptor().ParentId(selector); - public static QueryContainer Percolate(Func, IPercolateQuery> selector) => - new QueryContainerDescriptor().Percolate(selector); - - [Obsolete("Use overload that accepts MultiTermQueryRewrite as an argument")] - public static QueryContainer Prefix(Expression> fieldDescriptor, string value, double? boost = null, RewriteMultiTerm? rewrite = null, string name = null) => - new QueryContainerDescriptor().Prefix(fieldDescriptor, value, boost, rewrite, name); - - public static QueryContainer Prefix(Expression> fieldDescriptor, string value, double? boost = null, MultiTermQueryRewrite rewrite = null, string name = null) => - new QueryContainerDescriptor().Prefix(fieldDescriptor, value, boost, rewrite, name); - + public static QueryContainer Percolate(Func, IPercolateQuery> selector) => + new QueryContainerDescriptor().Percolate(selector); + + [Obsolete("Use overload that accepts MultiTermQueryRewrite as an argument")] + public static QueryContainer Prefix(Expression> fieldDescriptor, string value, double? boost = null, RewriteMultiTerm? rewrite = null, string name = null) => + new QueryContainerDescriptor().Prefix(fieldDescriptor, value, boost, rewrite, name); + + public static QueryContainer Prefix(Expression> fieldDescriptor, string value, double? boost = null, MultiTermQueryRewrite rewrite = null, string name = null) => + new QueryContainerDescriptor().Prefix(fieldDescriptor, value, boost, rewrite, name); + [Obsolete("Use overload that accepts MultiTermQueryRewrite as an argument")] public static QueryContainer Prefix(Field field, string value, double? boost = null, RewriteMultiTerm? rewrite = null, string name = null) => new QueryContainerDescriptor().Prefix(field, value, boost, rewrite, name); @@ -138,7 +139,7 @@ public static QueryContainer Prefix(Func, IPrefixQuery> new QueryContainerDescriptor().Prefix(selector); public static QueryContainer QueryString(Func, IQueryStringQuery> selector) => - new QueryContainerDescriptor().QueryString(selector); + new QueryContainerDescriptor().QueryString(selector); public static QueryContainer Range(Func, INumericRangeQuery> selector) => new QueryContainerDescriptor().Range(selector); @@ -196,7 +197,7 @@ public static QueryContainer TermRange(Func, ITermRa new QueryContainerDescriptor().TermRange(selector); public static QueryContainer Terms(Func, ITermsQuery> selector) => - new QueryContainerDescriptor().Terms(selector); + new QueryContainerDescriptor().Terms(selector); public static QueryContainer Type(Func selector) => new QueryContainerDescriptor().Type(selector); @@ -204,20 +205,20 @@ public static QueryContainer Type(Func selector public static QueryContainer Type() => Type(q => q.Value()); [Obsolete("Use overload that accepts MultiTermQueryRewrite as an argument")] - public static QueryContainer Wildcard(Expression> fieldDescriptor, string value, double? boost = null, RewriteMultiTerm? rewrite = null, string name = null) => - new QueryContainerDescriptor().Wildcard(fieldDescriptor, value, boost, rewrite, name); - - public static QueryContainer Wildcard(Expression> fieldDescriptor, string value, double? boost = null, MultiTermQueryRewrite rewrite = null, string name = null) => - new QueryContainerDescriptor().Wildcard(fieldDescriptor, value, boost, rewrite, name); - - [Obsolete("Use overload that accepts MultiTermQueryRewrite as an argument")] - public static QueryContainer Wildcard(Field field, string value, double? boost = null, RewriteMultiTerm? rewrite = null, string name = null) => - new QueryContainerDescriptor().Wildcard(field, value, boost, rewrite, name); - + public static QueryContainer Wildcard(Expression> fieldDescriptor, string value, double? boost = null, RewriteMultiTerm? rewrite = null, string name = null) => + new QueryContainerDescriptor().Wildcard(fieldDescriptor, value, boost, rewrite, name); + + public static QueryContainer Wildcard(Expression> fieldDescriptor, string value, double? boost = null, MultiTermQueryRewrite rewrite = null, string name = null) => + new QueryContainerDescriptor().Wildcard(fieldDescriptor, value, boost, rewrite, name); + + [Obsolete("Use overload that accepts MultiTermQueryRewrite as an argument")] + public static QueryContainer Wildcard(Field field, string value, double? boost = null, RewriteMultiTerm? rewrite = null, string name = null) => + new QueryContainerDescriptor().Wildcard(field, value, boost, rewrite, name); + public static QueryContainer Wildcard(Field field, string value, double? boost = null, MultiTermQueryRewrite rewrite = null, string name = null) => new QueryContainerDescriptor().Wildcard(field, value, boost, rewrite, name); public static QueryContainer Wildcard(Func, IWildcardQuery> selector) => - new QueryContainerDescriptor().Wildcard(selector); - } + new QueryContainerDescriptor().Wildcard(selector); + } } diff --git a/src/Nest/QueryDsl/Specialized/Script/ScriptQuery.cs b/src/Nest/QueryDsl/Specialized/Script/ScriptQuery.cs index aba5c4af0e1..1be0aa5128c 100644 --- a/src/Nest/QueryDsl/Specialized/Script/ScriptQuery.cs +++ b/src/Nest/QueryDsl/Specialized/Script/ScriptQuery.cs @@ -41,7 +41,11 @@ public class ScriptQuery : QueryBase, IScriptQuery internal override void InternalWrapInContainer(IQueryContainer c) => c.Script = this; internal static bool IsConditionless(IScriptQuery q) => - q.Inline.IsNullOrEmpty() && q.Id == null && q.File.IsNullOrEmpty(); + q.Inline.IsNullOrEmpty() && + q.Id == null && +#pragma warning disable 618 + q.File.IsNullOrEmpty(); +#pragma warning restore 618 } diff --git a/src/Nest/QueryDsl/Specialized/Script/ScriptQueryConverter.cs b/src/Nest/QueryDsl/Specialized/Script/ScriptQueryConverter.cs index 43d0e463fc2..79ba382b654 100644 --- a/src/Nest/QueryDsl/Specialized/Script/ScriptQueryConverter.cs +++ b/src/Nest/QueryDsl/Specialized/Script/ScriptQueryConverter.cs @@ -24,7 +24,9 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s writer.WriteStartObject(); { if (v.Id != null) writer.WriteProperty(serializer, "id", v.Id); +#pragma warning disable 618 if (v.File != null) writer.WriteProperty(serializer, "file", v.File); +#pragma warning restore 618 if (v.Inline != null) writer.WriteProperty(serializer, "inline", v.Inline); if (v.Lang != null) writer.WriteProperty(serializer, "lang", v.Lang); if (v.Params != null) writer.WriteProperty(serializer, "params", v.Params); @@ -56,7 +58,9 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist r.Id = p.Value.Value(); break; case "file": +#pragma warning disable 618 r.File = p.Value.Value(); +#pragma warning restore 618 break; case "inline": r.Inline = p.Value.Value(); diff --git a/src/Nest/QueryDsl/Visitor/DslPrettyPrintVisitor.cs b/src/Nest/QueryDsl/Visitor/DslPrettyPrintVisitor.cs index 0ae35dd39b7..cccc4bdc69c 100644 --- a/src/Nest/QueryDsl/Visitor/DslPrettyPrintVisitor.cs +++ b/src/Nest/QueryDsl/Visitor/DslPrettyPrintVisitor.cs @@ -147,13 +147,17 @@ private void Write(string queryType, Field field = null) public virtual void Visit(IGeoPolygonQuery query) => Write("geo_polygon"); +#pragma warning disable 618 public virtual void Visit(IGeoDistanceRangeQuery query) => Write("geo_distance_range"); +#pragma warning restore 618 public virtual void Visit(IGeoDistanceQuery query) => Write("geo_distance"); public virtual void Visit(IGeoHashCellQuery filter) => Write("geohash_cell"); +#pragma warning disable 618 public virtual void Visit(ITemplateQuery query) => Write("template"); +#pragma warning restore 618 public virtual void Visit(ISpanMultiTermQuery query) => Write("span_multi_term"); diff --git a/src/Nest/QueryDsl/Visitor/QueryVisitor.cs b/src/Nest/QueryDsl/Visitor/QueryVisitor.cs index 10c2327443e..3332b8b8b88 100644 --- a/src/Nest/QueryDsl/Visitor/QueryVisitor.cs +++ b/src/Nest/QueryDsl/Visitor/QueryVisitor.cs @@ -57,7 +57,9 @@ public interface IQueryVisitor void Visit(ITypeQuery query); void Visit(IScriptQuery query); void Visit(IGeoPolygonQuery query); +#pragma warning disable 618 void Visit(IGeoDistanceRangeQuery query); +#pragma warning restore 618 void Visit(IGeoDistanceQuery query); void Visit(IGeoBoundingBoxQuery query); void Visit(IGeoHashCellQuery query); @@ -65,7 +67,9 @@ public interface IQueryVisitor void Visit(IDateRangeQuery query); void Visit(INumericRangeQuery query); void Visit(ITermRangeQuery query); +#pragma warning disable 618 void Visit(ITemplateQuery query); +#pragma warning restore 618 void Visit(ISpanFirstQuery query); void Visit(ISpanNearQuery query); void Visit(ISpanNotQuery query); @@ -200,13 +204,17 @@ public virtual void Visit(IScriptQuery query) { } public virtual void Visit(IGeoPolygonQuery query) { } +#pragma warning disable 618 public virtual void Visit(IGeoDistanceRangeQuery query) { } +#pragma warning restore 618 public virtual void Visit(IGeoDistanceQuery query) { } public virtual void Visit(IGeoHashCellQuery query) { } +#pragma warning disable 618 public virtual void Visit(ITemplateQuery query) { } +#pragma warning restore 618 public virtual void Visit(IGeoShapeMultiPointQuery query) { } diff --git a/src/Nest/QueryDsl/Visitor/QueryWalker.cs b/src/Nest/QueryDsl/Visitor/QueryWalker.cs index fc0452b85ab..330541ee360 100644 --- a/src/Nest/QueryDsl/Visitor/QueryWalker.cs +++ b/src/Nest/QueryDsl/Visitor/QueryWalker.cs @@ -56,11 +56,15 @@ public void Walk(IQueryContainer qd, IQueryVisitor visitor) VisitQuery(qd.Script, visitor, (v, d) => v.Visit(d)); VisitQuery(qd.Exists, visitor, (v, d) => v.Visit(d)); VisitQuery(qd.GeoPolygon, visitor, (v, d) => v.Visit(d)); +#pragma warning disable 618 VisitQuery(qd.GeoDistanceRange, visitor, (v, d) => v.Visit(d)); +#pragma warning restore 618 VisitQuery(qd.GeoDistance, visitor, (v, d) => v.Visit(d)); VisitQuery(qd.GeoBoundingBox, visitor, (v, d) => v.Visit(d)); VisitQuery(qd.GeoHashCell, visitor, (v, d) => v.Visit(d)); +#pragma warning disable 618 VisitQuery(qd.Template, visitor, (v, d) => v.Visit(d)); +#pragma warning restore 618 VisitQuery(qd.RawQuery, visitor, (v, d) => v.Visit(d)); VisitQuery(qd.Percolate, visitor, (v, d) => v.Visit(d)); VisitQuery(qd.ParentId, visitor, (v, d) => v.Visit(d)); diff --git a/src/Nest/Search/FieldStats/ElasticClient-FieldStats.cs b/src/Nest/Search/FieldStats/ElasticClient-FieldStats.cs index d944d5010a2..5ca7e4b1285 100644 --- a/src/Nest/Search/FieldStats/ElasticClient-FieldStats.cs +++ b/src/Nest/Search/FieldStats/ElasticClient-FieldStats.cs @@ -7,36 +7,56 @@ namespace Nest { public partial interface IElasticClient { - /// + /// + /// Find statistical properties of a field without executing a search, + /// but looking up measurements that are natively available in the Lucene index. + /// + [Obsolete("Scheduled to be removed in 6.0. Use FieldCapabilities instead")] IFieldStatsResponse FieldStats(Indices indices, Func selector = null); - /// + /// + /// Find statistical properties of a field without executing a search, + /// but looking up measurements that are natively available in the Lucene index. + /// + [Obsolete("Scheduled to be removed in 6.0. Use FieldCapabilities instead")] IFieldStatsResponse FieldStats(IFieldStatsRequest request); - /// + /// + /// Find statistical properties of a field without executing a search, + /// but looking up measurements that are natively available in the Lucene index. + /// + [Obsolete("Scheduled to be removed in 6.0. Use FieldCapabilities instead")] Task FieldStatsAsync(Indices indices, Func selector= null, CancellationToken cancellationToken = default(CancellationToken)); - /// + /// + /// Find statistical properties of a field without executing a search, + /// but looking up measurements that are natively available in the Lucene index. + /// + [Obsolete("Scheduled to be removed in 6.0. Use FieldCapabilities instead")] Task FieldStatsAsync(IFieldStatsRequest request, CancellationToken cancellationToken = default(CancellationToken)); } public partial class ElasticClient { /// + [Obsolete("Scheduled to be removed in 6.0. Use FieldCapabilities instead")] public IFieldStatsResponse FieldStats(Indices indices, Func selector = null) => this.FieldStats(selector.InvokeOrDefault(new FieldStatsDescriptor().Index(indices))); /// + [Obsolete("Scheduled to be removed in 6.0. Use FieldCapabilities instead")] public IFieldStatsResponse FieldStats(IFieldStatsRequest request) => this.Dispatcher.Dispatch( request, this.LowLevelDispatch.FieldStatsDispatch ); /// + [Obsolete("Scheduled to be removed in 6.0. Use FieldCapabilities instead")] public Task FieldStatsAsync(Indices indices, Func selector = null, CancellationToken cancellationToken = default(CancellationToken)) => this.FieldStatsAsync(selector.InvokeOrDefault(new FieldStatsDescriptor().Index(indices)), cancellationToken); /// + [Obsolete("Scheduled to be removed in 6.0. Use FieldCapabilities instead")] public Task FieldStatsAsync(IFieldStatsRequest request, CancellationToken cancellationToken = default(CancellationToken)) => this.Dispatcher.DispatchAsync( request, diff --git a/src/Nest/Search/FieldStats/FieldStatsRequest.cs b/src/Nest/Search/FieldStats/FieldStatsRequest.cs index ca6b40d96d5..ac8a1168176 100644 --- a/src/Nest/Search/FieldStats/FieldStatsRequest.cs +++ b/src/Nest/Search/FieldStats/FieldStatsRequest.cs @@ -5,7 +5,7 @@ namespace Nest { - [Obsolete("Scheduled to be removed in 6.0")] + [Obsolete("Scheduled to be removed in 6.0. Use FieldCapabilities instead")] public partial interface IFieldStatsRequest { [JsonProperty("fields")] @@ -15,7 +15,7 @@ public partial interface IFieldStatsRequest IIndexConstraints IndexConstraints { get; set; } } - [Obsolete("Scheduled to be removed in 6.0")] + [Obsolete("Scheduled to be removed in 6.0. Use FieldCapabilities instead")] public partial class FieldStatsRequest { public Fields Fields { get; set; } @@ -23,7 +23,7 @@ public partial class FieldStatsRequest } - [Obsolete("Scheduled to be removed in 6.0")] + [Obsolete("Scheduled to be removed in 6.0. Use FieldCapabilities instead")] public partial class FieldStatsDescriptor { Fields IFieldStatsRequest.Fields { get; set; } diff --git a/src/Nest/Search/SearchTemplate/ElasticClient-SearchTemplate.cs b/src/Nest/Search/SearchTemplate/ElasticClient-SearchTemplate.cs index 6837f2678e3..ccd811e5396 100644 --- a/src/Nest/Search/SearchTemplate/ElasticClient-SearchTemplate.cs +++ b/src/Nest/Search/SearchTemplate/ElasticClient-SearchTemplate.cs @@ -13,9 +13,6 @@ public partial interface IElasticClient /// The /_search/template endpoint allows to use the mustache language to pre render search /// requests, before they are executed and fill existing templates with template parameters. /// - /// The type used to infer the index and typename as well describe the query strongly typed - /// A descriptor that describes the parameters for the search operation - /// ISearchResponse SearchTemplate(Func, ISearchTemplateRequest> selector) where T : class; diff --git a/src/Nest/Search/SearchTemplate/PutSearchTemplate/ElasticClient-PutSearchTemplate.cs b/src/Nest/Search/SearchTemplate/PutSearchTemplate/ElasticClient-PutSearchTemplate.cs index e0a5926641a..278f38b209d 100644 --- a/src/Nest/Search/SearchTemplate/PutSearchTemplate/ElasticClient-PutSearchTemplate.cs +++ b/src/Nest/Search/SearchTemplate/PutSearchTemplate/ElasticClient-PutSearchTemplate.cs @@ -7,26 +7,44 @@ namespace Nest { public partial interface IElasticClient { - /// + /// + /// Stores a search template that can be used to pre render search requests, + /// before they are executed and fill the search template with template parameters. + /// + [Obsolete("Removed in NEST 6.x. In NEST 6.x, use the PutScript API to store templates")] IPutSearchTemplateResponse PutSearchTemplate(Id id, Func selector); - /// + /// + /// Stores a search template that can be used to pre render search requests, + /// before they are executed and fill the search template with template parameters. + /// + [Obsolete("Removed in NEST 6.x. In NEST 6.x, use the PutScript API to store templates")] IPutSearchTemplateResponse PutSearchTemplate(IPutSearchTemplateRequest request); - /// + /// + /// Stores a search template that can be used to pre render search requests, + /// before they are executed and fill the search template with template parameters. + /// + [Obsolete("Removed in NEST 6.x. In NEST 6.x, use the PutScript API to store templates")] Task PutSearchTemplateAsync(Id id, Func selector, CancellationToken cancellationToken = default(CancellationToken)); - /// + /// + /// Stores a search template that can be used to pre render search requests, + /// before they are executed and fill the search template with template parameters. + /// + [Obsolete("Removed in NEST 6.x. In NEST 6.x, use the PutScript API to store templates")] Task PutSearchTemplateAsync(IPutSearchTemplateRequest request, CancellationToken cancellationToken = default(CancellationToken)); } public partial class ElasticClient { /// + [Obsolete("Removed in NEST 6.x. In NEST 6.x, use the PutScript API to store templates")] public IPutSearchTemplateResponse PutSearchTemplate(Id id, Func selector) => this.PutSearchTemplate(selector?.Invoke(new PutSearchTemplateDescriptor(id))); /// + [Obsolete("Removed in NEST 6.x. In NEST 6.x, use the PutScript API to store templates")] public IPutSearchTemplateResponse PutSearchTemplate(IPutSearchTemplateRequest request) => this.Dispatcher.Dispatch( request, @@ -34,10 +52,12 @@ public IPutSearchTemplateResponse PutSearchTemplate(IPutSearchTemplateRequest re ); /// + [Obsolete("Removed in NEST 6.x. In NEST 6.x, use the PutScript API to store templates")] public Task PutSearchTemplateAsync(Id id, Func selector, CancellationToken cancellationToken = default(CancellationToken)) => this.PutSearchTemplateAsync(selector?.Invoke(new PutSearchTemplateDescriptor(id)), cancellationToken); /// + [Obsolete("Removed in NEST 6.x. In NEST 6.x, use the PutScript API to store templates")] public Task PutSearchTemplateAsync(IPutSearchTemplateRequest request, CancellationToken cancellationToken = default(CancellationToken)) => this.Dispatcher.DispatchAsync( request, diff --git a/src/Nest/Search/SearchTemplate/PutSearchTemplate/PutSearchTemplateRequest.cs b/src/Nest/Search/SearchTemplate/PutSearchTemplate/PutSearchTemplateRequest.cs index a8909fd0887..1b78b37b1e9 100644 --- a/src/Nest/Search/SearchTemplate/PutSearchTemplate/PutSearchTemplateRequest.cs +++ b/src/Nest/Search/SearchTemplate/PutSearchTemplate/PutSearchTemplateRequest.cs @@ -3,7 +3,7 @@ namespace Nest { - [Obsolete("Removed in NEST 6.x.")] + [Obsolete("Removed in NEST 6.x. In NEST 6.x, use the PutScript API to store templates")] [JsonConverter(typeof(ReadAsTypeJsonConverter))] public partial interface IPutSearchTemplateRequest { @@ -11,13 +11,13 @@ public partial interface IPutSearchTemplateRequest string Template { get; set; } } - [Obsolete("Removed in NEST 6.x.")] + [Obsolete("Removed in NEST 6.x. In NEST 6.x, use the PutScript API to store templates")] public partial class PutSearchTemplateRequest { public string Template { get; set; } } - [Obsolete("Removed in NEST 6.x.")] + [Obsolete("Removed in NEST 6.x. In NEST 6.x, use the PutScript API to store templates")] [DescriptorFor("PutTemplate")] public partial class PutSearchTemplateDescriptor { diff --git a/src/Nest/Search/Suggesters/PhraseSuggester/PhraseSuggestCollate.cs b/src/Nest/Search/Suggesters/PhraseSuggester/PhraseSuggestCollate.cs index e8dfd84db2d..deb78392b7a 100644 --- a/src/Nest/Search/Suggesters/PhraseSuggester/PhraseSuggestCollate.cs +++ b/src/Nest/Search/Suggesters/PhraseSuggester/PhraseSuggestCollate.cs @@ -19,7 +19,9 @@ public interface IPhraseSuggestCollate /// Query parameters should be specified using /// [JsonProperty("query")] +#pragma warning disable 618 ITemplateQuery Query { get; set; } +#pragma warning restore 618 /// /// Controls if all phrase suggestions will be returned. When set to true, the suggestions will have @@ -39,10 +41,12 @@ public interface IPhraseSuggestCollate /// public class PhraseSuggestCollate : IPhraseSuggestCollate { +#pragma warning disable 618 private ITemplateQuery _query; /// public ITemplateQuery Query +#pragma warning restore 618 { get => _query; set @@ -62,7 +66,9 @@ public ITemplateQuery Query public class PhraseSuggestCollateDescriptor : DescriptorBase, IPhraseSuggestCollate>, IPhraseSuggestCollate where T : class { +#pragma warning disable 618 ITemplateQuery IPhraseSuggestCollate.Query { get; set; } +#pragma warning restore 618 IDictionary IPhraseSuggestCollate.Params { get; set; } bool? IPhraseSuggestCollate.Prune { get; set; } @@ -73,6 +79,7 @@ public class PhraseSuggestCollateDescriptor : DescriptorBase or /// Params(Func<FluentDictionary<string, object>, FluentDictionary<string, object>>) /// +#pragma warning disable 618 public PhraseSuggestCollateDescriptor Query(Func, ITemplateQuery> selector) => Assign(a => { @@ -80,6 +87,7 @@ public PhraseSuggestCollateDescriptor Query(Func, a.Query = templateQuery; if (templateQuery != null) Self.Params = templateQuery.Params; }); +#pragma warning restore 618 /// /// Controls if all phrase suggestions will be returned. When set to true, the suggestions will have diff --git a/src/Nest/Search/Suggesters/Suggest/SuggestRequestJsonConverter.cs b/src/Nest/Search/Suggesters/Suggest/SuggestRequestJsonConverter.cs index 2617a00da60..d27f05e73e4 100644 --- a/src/Nest/Search/Suggesters/Suggest/SuggestRequestJsonConverter.cs +++ b/src/Nest/Search/Suggesters/Suggest/SuggestRequestJsonConverter.cs @@ -18,7 +18,9 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { +#pragma warning disable 618 var suggestRequest = value as ISuggestRequest; +#pragma warning restore 618 if (suggestRequest == null) return; writer.WriteStartObject(); diff --git a/src/Nest/XPack/Watcher/Condition/ScriptConditionBase.cs b/src/Nest/XPack/Watcher/Condition/ScriptConditionBase.cs index 495a711c178..9c15ed193ea 100644 --- a/src/Nest/XPack/Watcher/Condition/ScriptConditionBase.cs +++ b/src/Nest/XPack/Watcher/Condition/ScriptConditionBase.cs @@ -76,7 +76,9 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist if (dict.ContainsKey("file")) { var file = dict["file"].ToString(); +#pragma warning disable 618 scriptCondition = new FileScriptCondition(file); +#pragma warning restore 618 } if (dict.ContainsKey("id")) { diff --git a/src/Tests/Aggregations/Metric/TopHits/TopHitsAggregationUsageTests.cs b/src/Tests/Aggregations/Metric/TopHits/TopHitsAggregationUsageTests.cs index ad503ad18b9..39e85352759 100644 --- a/src/Tests/Aggregations/Metric/TopHits/TopHitsAggregationUsageTests.cs +++ b/src/Tests/Aggregations/Metric/TopHits/TopHitsAggregationUsageTests.cs @@ -90,6 +90,7 @@ public TopHitsAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage) : ba } }; +#pragma warning disable 618 // Use of FielddataFields protected override Func, ISearchRequest> Fluent => s => s .Aggregations(a => a .Terms("states", t => t @@ -143,6 +144,7 @@ public TopHitsAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage) : ba ) ) ); +#pragma warning restore 618 protected override SearchRequest Initializer => new SearchRequest @@ -170,7 +172,9 @@ public TopHitsAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage) : ba Version = true, TrackScores = true, Explain = true, +#pragma warning disable 618 FielddataFields = new [] { "state", "numberOfCommits" }, +#pragma warning restore 618 StoredFields = new[] { "startedOn" }, Highlight = new Highlight { diff --git a/src/Tests/Analysis/TokenFilters/TokenFilterUsageTests.cs b/src/Tests/Analysis/TokenFilters/TokenFilterUsageTests.cs index f7c3db886d8..128db660fac 100644 --- a/src/Tests/Analysis/TokenFilters/TokenFilterUsageTests.cs +++ b/src/Tests/Analysis/TokenFilters/TokenFilterUsageTests.cs @@ -326,6 +326,7 @@ public class TokenFilterUsageTests : PromiseUsageTestBase t .Articles("a", "b", "c") ) +#pragma warning disable 618 // Use of HunSpell IgnoreCase .Hunspell("hunspell", t => t .Dedup() .Dictionary("path_to_dict") @@ -333,6 +334,7 @@ public class TokenFilterUsageTests : PromiseUsageTestBase t .MaxSubwordSize(2) .MinSubwordSize(2) @@ -504,7 +506,9 @@ public class TokenFilterUsageTests : PromiseUsageTestBase(p => p.Name); +#pragma warning disable 618 [Setup] +#pragma warning restore 618 public void Setup() { _expressionResolver = new FieldResolver(new ConnectionSettings()); diff --git a/src/Tests/ClientConcepts/HighLevel/Caching/PropertyNameResolverBenchmarkTests.cs b/src/Tests/ClientConcepts/HighLevel/Caching/PropertyNameResolverBenchmarkTests.cs index 35ee0348d59..fc6fc14f907 100644 --- a/src/Tests/ClientConcepts/HighLevel/Caching/PropertyNameResolverBenchmarkTests.cs +++ b/src/Tests/ClientConcepts/HighLevel/Caching/PropertyNameResolverBenchmarkTests.cs @@ -19,7 +19,9 @@ public class PropertyNameResolverBenchmarkTests private static readonly PropertyName PropertyInfoPropertyName = typeof(Project).GetProperty(nameof(Project.Name)); private static readonly PropertyName StringPropertyName = "Name"; +#pragma warning disable 618 [Setup] +#pragma warning restore 618 public void Setup() { _expressionResolver = new FieldResolver(new ConnectionSettings()); diff --git a/src/Tests/Cluster/ClusterState/ClusterStatsApiTests.cs b/src/Tests/Cluster/ClusterState/ClusterStateApiTests.cs similarity index 98% rename from src/Tests/Cluster/ClusterState/ClusterStatsApiTests.cs rename to src/Tests/Cluster/ClusterState/ClusterStateApiTests.cs index 532def5dcc9..77607703ad1 100644 --- a/src/Tests/Cluster/ClusterState/ClusterStatsApiTests.cs +++ b/src/Tests/Cluster/ClusterState/ClusterStateApiTests.cs @@ -54,7 +54,9 @@ private void Assert(MetadataState meta) meta.Templates.Should().NotBeEmpty().And.ContainKey("nest_tests"); var rawFieldsTemplate = meta.Templates["nest_tests"]; +#pragma warning disable 618 rawFieldsTemplate.Template.Should().NotBeNullOrWhiteSpace(); +#pragma warning restore 618 rawFieldsTemplate.Settings.Should().NotBeNull(); rawFieldsTemplate.Settings.NumberOfShards.Should().Be(2); diff --git a/src/Tests/Document/Multiple/Bulk/BulkDeserializationBenchmarkTests.cs b/src/Tests/Document/Multiple/Bulk/BulkDeserializationBenchmarkTests.cs index 16e44e5f27a..00e2ef3b879 100644 --- a/src/Tests/Document/Multiple/Bulk/BulkDeserializationBenchmarkTests.cs +++ b/src/Tests/Document/Multiple/Bulk/BulkDeserializationBenchmarkTests.cs @@ -28,7 +28,9 @@ public class BulkDeserializationBenchmarkTests private byte[] _hugeResponse; private JsonSerializer _jsonSerializer; +#pragma warning disable 618 [Setup] +#pragma warning restore 618 public void Setup() { var serializer = Client.Serializer; diff --git a/src/Tests/Document/Multiple/Bulk/BulkIndexingBenchmarkTests.cs b/src/Tests/Document/Multiple/Bulk/BulkIndexingBenchmarkTests.cs index 1a1e8c7e193..f3310209e64 100644 --- a/src/Tests/Document/Multiple/Bulk/BulkIndexingBenchmarkTests.cs +++ b/src/Tests/Document/Multiple/Bulk/BulkIndexingBenchmarkTests.cs @@ -42,7 +42,9 @@ public BulkIndexingBenchmarkTests() ); } +#pragma warning disable 618 [Setup] +#pragma warning restore 618 [ProfilingSetup] public void Setup() { diff --git a/src/Tests/Document/Multiple/Bulk/BulkInvalidApiTests.cs b/src/Tests/Document/Multiple/Bulk/BulkInvalidApiTests.cs index 7fbed0603f8..45ee4652dd8 100644 --- a/src/Tests/Document/Multiple/Bulk/BulkInvalidApiTests.cs +++ b/src/Tests/Document/Multiple/Bulk/BulkInvalidApiTests.cs @@ -55,7 +55,9 @@ protected override void ExpectResponse(IBulkResponse response) failedUpdate.IsValid.Should().BeFalse(); var failedDelete = response.Items.Last() as BulkDeleteResponseItem; +#pragma warning disable 618 failedDelete.Found.Should().BeFalse(); +#pragma warning restore 618 failedDelete.IsValid.Should().BeTrue(); } diff --git a/src/Tests/Document/Single/Attachment/AttachmentApiTests.cs b/src/Tests/Document/Single/Attachment/AttachmentApiTests.cs index 8b651dba467..1a8cc35bb4f 100644 --- a/src/Tests/Document/Single/Attachment/AttachmentApiTests.cs +++ b/src/Tests/Document/Single/Attachment/AttachmentApiTests.cs @@ -45,6 +45,8 @@ protected override void IntegrationSetup(IElasticClient client, CallUniqueValues foreach (var callUniqueValue in values) { var index = callUniqueValue.Value; + +#pragma warning disable 618 // Use of Attachment mapping var indexResponse = client.CreateIndex(index, c => c .Mappings(m => m .Map(mm => mm @@ -92,6 +94,7 @@ protected override void IntegrationSetup(IElasticClient client, CallUniqueValues ) ) ); +#pragma warning restore 618 if (!indexResponse.IsValid) { diff --git a/src/Tests/Document/Single/Create/CreateApiTests.cs b/src/Tests/Document/Single/Create/CreateApiTests.cs index b67e0c83b70..81c64dcc690 100644 --- a/src/Tests/Document/Single/Create/CreateApiTests.cs +++ b/src/Tests/Document/Single/Create/CreateApiTests.cs @@ -85,7 +85,9 @@ public void CreateWithSameIndexTypeAndId() ); createResponse.ShouldBeValid(); createResponse.ApiCall.HttpStatusCode.Should().Be(201); +#pragma warning disable 618 createResponse.Created.Should().BeTrue(); +#pragma warning restore 618 createResponse.Result.Should().Be(Result.Created); createResponse.Index.Should().Be(index); createResponse.Type.Should().Be(this.Client.Infer.TypeName()); @@ -96,7 +98,9 @@ public void CreateWithSameIndexTypeAndId() ); createResponse.ShouldNotBeValid(); +#pragma warning disable 618 createResponse.Created.Should().BeFalse(); +#pragma warning restore 618 createResponse.ApiCall.HttpStatusCode.Should().Be(409); } } @@ -135,7 +139,9 @@ public void Create() createResponse.ShouldBeValid(); createResponse.ApiCall.HttpStatusCode.Should().Be(201); +#pragma warning disable 618 createResponse.Created.Should().BeTrue(); +#pragma warning restore 618 createResponse.Index.Should().Be(index); createResponse.Type.Should().Be("jobject"); @@ -182,7 +188,9 @@ public void Create() createResponse.ShouldBeValid(); createResponse.ApiCall.HttpStatusCode.Should().Be(201); +#pragma warning disable 618 createResponse.Created.Should().BeTrue(); +#pragma warning restore 618 createResponse.Index.Should().Be(index); createResponse.Result.Should().Be(Result.Created); createResponse.Type.Should().StartWith("<>"); diff --git a/src/Tests/Document/Single/Delete/DeleteApiTests.cs b/src/Tests/Document/Single/Delete/DeleteApiTests.cs index d6ed70cfbc6..08912d4359e 100644 --- a/src/Tests/Document/Single/Delete/DeleteApiTests.cs +++ b/src/Tests/Document/Single/Delete/DeleteApiTests.cs @@ -41,7 +41,9 @@ protected override LazyResponses ClientUsage() => Calls( protected override void ExpectResponse(IDeleteResponse response) { response.ShouldBeValid(); +#pragma warning disable 618 response.Found.Should().BeTrue(); +#pragma warning restore 618 response.Result.Should().Be(Result.Deleted); } } @@ -69,7 +71,9 @@ protected override LazyResponses ClientUsage() => Calls( protected override void ExpectResponse(IDeleteResponse response) { +#pragma warning disable 618 response.Found.Should().BeFalse(); +#pragma warning restore 618 response.Index.Should().Be("project"); response.Type.Should().Be("project"); response.Id.Should().Be(this.CallIsolatedValue); diff --git a/src/Tests/Framework/ManagedElasticsearch/NodeSeeders/DefaultSeeder.cs b/src/Tests/Framework/ManagedElasticsearch/NodeSeeders/DefaultSeeder.cs index 9917ccd985f..8f8f1b70f29 100644 --- a/src/Tests/Framework/ManagedElasticsearch/NodeSeeders/DefaultSeeder.cs +++ b/src/Tests/Framework/ManagedElasticsearch/NodeSeeders/DefaultSeeder.cs @@ -91,7 +91,9 @@ private void CreateIndexTemplate() { var putTemplateResult = this.Client.PutIndexTemplate(new PutIndexTemplateRequest(TestsIndexTemplateName) { +#pragma warning disable 618 Template = "*", +#pragma warning restore 618 Settings = this.IndexSettings }); putTemplateResult.ShouldBeValid(); diff --git a/src/Tests/Framework/ManagedElasticsearch/NodeSeeders/MachineLearningSeeder.cs b/src/Tests/Framework/ManagedElasticsearch/NodeSeeders/MachineLearningSeeder.cs index 625b9411f23..0eb8627095c 100644 --- a/src/Tests/Framework/ManagedElasticsearch/NodeSeeders/MachineLearningSeeder.cs +++ b/src/Tests/Framework/ManagedElasticsearch/NodeSeeders/MachineLearningSeeder.cs @@ -107,7 +107,9 @@ private void CreateIndexTemplate() { var putTemplateResult = this.Client.PutIndexTemplate(new PutIndexTemplateRequest(MachineLearningTestsIndexTemplateName) { +#pragma warning disable 618 Template = "*", +#pragma warning restore 618 Settings = new IndexSettings { NumberOfShards = 1, diff --git a/src/Tests/Indices/IndexSettings/IndexTemplates/GetIndexTemplate/GetIndexTemplateApiTests.cs b/src/Tests/Indices/IndexSettings/IndexTemplates/GetIndexTemplate/GetIndexTemplateApiTests.cs index 27306b38076..6372f869543 100644 --- a/src/Tests/Indices/IndexSettings/IndexTemplates/GetIndexTemplate/GetIndexTemplateApiTests.cs +++ b/src/Tests/Indices/IndexSettings/IndexTemplates/GetIndexTemplate/GetIndexTemplateApiTests.cs @@ -39,11 +39,13 @@ protected override void IntegrationSetup(IElasticClient client, CallUniqueValues { foreach (var callUniqueValue in values) { +#pragma warning disable 618 var putTemplateResponse = client.PutIndexTemplate(callUniqueValue.Value, d => d.Template("nestx-*") .Settings(s => s.NumberOfShards(2)) .Version(1) ); +#pragma warning restore 618 if (!putTemplateResponse.IsValid) throw new Exception($"Problem putting index template for integration test: {putTemplateResponse.DebugInformation}"); @@ -59,8 +61,10 @@ protected override void ExpectResponse(IGetIndexTemplateResponse response) var responseTemplateMapping = response.TemplateMappings[CallIsolatedValue]; +#pragma warning disable 618 responseTemplateMapping.Template.Should().NotBeNull(); responseTemplateMapping.Template.Should().Be("nestx-*"); +#pragma warning restore 618 responseTemplateMapping.Version.Should().Be(1); diff --git a/src/Tests/Indices/IndexSettings/IndexTemplates/IndexTemplateCrudTests.cs b/src/Tests/Indices/IndexSettings/IndexTemplates/IndexTemplateCrudTests.cs index b1d7e909e8c..1cd8d7c1c02 100644 --- a/src/Tests/Indices/IndexSettings/IndexTemplates/IndexTemplateCrudTests.cs +++ b/src/Tests/Indices/IndexSettings/IndexTemplates/IndexTemplateCrudTests.cs @@ -6,6 +6,7 @@ using Tests.Framework.Integration; using Tests.Framework.ManagedElasticsearch.Clusters; using Xunit; +#pragma warning disable 618 namespace Tests.Indices.IndexSettings.IndexTemplates { @@ -67,6 +68,7 @@ protected override LazyResponses Update() => Calls c.PutIndexTemplate(r), requestAsync: (s, c, r) => c.PutIndexTemplateAsync(r) ); + protected PutIndexTemplateRequest PutInitializer(string name) => new PutIndexTemplateRequest(name) { Template = "startingwiththis-*", diff --git a/src/Tests/Indices/IndexSettings/IndexTemplates/PutIndexTemplate/PutIndexTemplateApiTests.cs b/src/Tests/Indices/IndexSettings/IndexTemplates/PutIndexTemplate/PutIndexTemplateApiTests.cs index f7adb168982..f09c883958b 100644 --- a/src/Tests/Indices/IndexSettings/IndexTemplates/PutIndexTemplate/PutIndexTemplateApiTests.cs +++ b/src/Tests/Indices/IndexSettings/IndexTemplates/PutIndexTemplate/PutIndexTemplateApiTests.cs @@ -63,6 +63,7 @@ protected override LazyResponses ClientUsage() => Calls( protected override PutIndexTemplateDescriptor NewDescriptor() => new PutIndexTemplateDescriptor(CallIsolatedValue); +#pragma warning disable 618 protected override Func Fluent => d => d .Order(1) .Version(2) @@ -84,14 +85,16 @@ protected override LazyResponses ClientUsage() => Calls( ) ) ); - +#pragma warning restore 618 protected override PutIndexTemplateRequest Initializer => new PutIndexTemplateRequest(CallIsolatedValue) { Order = 1, Version = 2, +#pragma warning disable 618 Template = "nestx-*", +#pragma warning restore 618 Create = false, Settings = new Nest.IndexSettings { diff --git a/src/Tests/Indices/MappingManagement/GetMapping/GetMappingApiTest.cs b/src/Tests/Indices/MappingManagement/GetMapping/GetMappingApiTest.cs index 51e7652a3c5..ab2d2bd3d7c 100644 --- a/src/Tests/Indices/MappingManagement/GetMapping/GetMappingApiTest.cs +++ b/src/Tests/Indices/MappingManagement/GetMapping/GetMappingApiTest.cs @@ -132,12 +132,10 @@ public void CountsShouldContainKeyAndCountBe(string key, int count) } #pragma warning disable 618 - public void Visit(IStringProperty mapping) { Increment("string"); } - #pragma warning restore 618 public void Visit(IDateProperty mapping) @@ -160,10 +158,12 @@ public void Visit(IGeoPointProperty mapping) Increment("geo_point"); } +#pragma warning disable 618 public void Visit(IAttachmentProperty mapping) { Increment("attachment"); } +#pragma warning restore 618 public void Visit(ICompletionProperty mapping) { diff --git a/src/Tests/Mapping/Types/SingleMappingPropertyTestsBase.cs b/src/Tests/Mapping/Types/SingleMappingPropertyTestsBase.cs index 9d8fc00d27c..c113f50432d 100644 --- a/src/Tests/Mapping/Types/SingleMappingPropertyTestsBase.cs +++ b/src/Tests/Mapping/Types/SingleMappingPropertyTestsBase.cs @@ -54,6 +54,8 @@ protected override LazyResponses ClientUsage() => Calls( protected abstract object SingleMappingJson { get; } protected override PutIndexTemplateDescriptor NewDescriptor() => new PutIndexTemplateDescriptor(CallIsolatedValue); + +#pragma warning disable 618 // Use of Template protected override Func Fluent => d => d .Order(1) .Template("nestx-*") @@ -70,6 +72,7 @@ protected override LazyResponses ClientUsage() => Calls( ) ) ); +#pragma warning restore 618 protected abstract Func, IProperty> FluentSingleMapping { get; } protected abstract IProperty InitializerSingleMapping { get; } @@ -77,7 +80,9 @@ protected override LazyResponses ClientUsage() => Calls( protected override PutIndexTemplateRequest Initializer => new PutIndexTemplateRequest(CallIsolatedValue) { Order = 1, +#pragma warning disable 618 Template = "nestx-*", +#pragma warning restore 618 Create = false, Settings = new Nest.IndexSettings { diff --git a/src/Tests/QueryDsl/Compound/FunctionScore/FunctionScoreQueryUsageTests.cs b/src/Tests/QueryDsl/Compound/FunctionScore/FunctionScoreQueryUsageTests.cs index 6b87cd7efdf..9b3e97ce8cc 100644 --- a/src/Tests/QueryDsl/Compound/FunctionScore/FunctionScoreQueryUsageTests.cs +++ b/src/Tests/QueryDsl/Compound/FunctionScore/FunctionScoreQueryUsageTests.cs @@ -109,7 +109,9 @@ public FunctionScoreQueryUsageTests(ReadOnlyCluster i, EndpointUsage usage) : ba new RandomScoreFunction { Seed = 1337 }, new RandomScoreFunction { Seed = "randomstring" }, new WeightFunction { Weight = 1.0}, +#pragma warning disable 618 new ScriptScoreFunction { Script = new ScriptQuery { File = "x" } } +#pragma warning restore 618 } }; @@ -130,7 +132,9 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor .RandomScore(1337) .RandomScore("randomstring") .Weight(1.0) +#pragma warning disable 618 .ScriptScore(ss => ss.Script(s => s.File("x"))) +#pragma warning restore 618 ) ); diff --git a/src/Tests/QueryDsl/FullText/CommonTerms/CommonTermsUsageTests.cs b/src/Tests/QueryDsl/FullText/CommonTerms/CommonTermsUsageTests.cs index e939c1a1469..ee9b1a059f3 100644 --- a/src/Tests/QueryDsl/FullText/CommonTerms/CommonTermsUsageTests.cs +++ b/src/Tests/QueryDsl/FullText/CommonTerms/CommonTermsUsageTests.cs @@ -35,7 +35,9 @@ public CommonTermsUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, u Analyzer = "standard", Boost = 1.1, CutoffFrequency = 0.001, +#pragma warning disable 618 // DisableCoord removed in 6.x DisableCoord = true, +#pragma warning restore 618 HighFrequencyOperator = Operator.And, LowFrequencyOperator = Operator.Or, MinimumShouldMatch = 1, @@ -43,6 +45,7 @@ public CommonTermsUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, u Query = "nelly the elephant not as a" }; +#pragma warning disable 618 // DisableCoord removed in 6.x protected override QueryContainer QueryFluent(QueryContainerDescriptor q) => q .CommonTerms(c => c .Field(p => p.Description) @@ -56,6 +59,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor .Name("named_query") .Query("nelly the elephant not as a") ); +#pragma warning restore 618 protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen(a => a.CommonTerms) { diff --git a/src/Tests/QueryDsl/FullText/QueryString/QueryStringUsageTests.cs b/src/Tests/QueryDsl/FullText/QueryString/QueryStringUsageTests.cs index e5ca7fca209..0140a09d7d6 100644 --- a/src/Tests/QueryDsl/FullText/QueryString/QueryStringUsageTests.cs +++ b/src/Tests/QueryDsl/FullText/QueryString/QueryStringUsageTests.cs @@ -55,15 +55,15 @@ public QueryStringUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, u Analyzer = "standard", QuoteAnalyzer = "quote-an", AllowLeadingWildcard = true, - AutoGeneratePhraseQueries = true, MaximumDeterminizedStates = 2, -#pragma warning disable 618 // usage of lowercase_expanded_terms and locale +#pragma warning disable 618 // Removed in NEST 6.x + AutoGeneratePhraseQueries = true, LowercaseExpendedTerms = true, Locale = "en_US", -#pragma warning restore 618 // usage of lowercase_expanded_terms and locale + UseDisMax = true, +#pragma warning restore 618 EnablePositionIncrements = true, Escape = true, - UseDisMax = true, FuzzyPrefixLength = 2, FuzzyMaxExpansions = 3, FuzzyMultiTermQueryRewrite = MultiTermQueryRewrite.ConstantScore, @@ -73,7 +73,7 @@ public QueryStringUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, u AnalyzeWildcard = true, MinimumShouldMatch = 2, QuoteFieldSuffix = "'", - Lenient = true, + Lenient = true, Timezone = "root" }; @@ -89,12 +89,13 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor .Analyzer("standard") .QuoteAnalyzer("quote-an") .AllowLeadingWildcard() - .AutoGeneratePhraseQueries() .MaximumDeterminizedStates(2) + .AutoGeneratePhraseQueries() .LowercaseExpendedTerms() + .Locale("en_US") + .UseDisMax() .EnablePositionIncrements() .Escape() - .UseDisMax() .FuzzyPrefixLength(2) .FuzzyMaxExpansions(3) .FuzzyRewrite(MultiTermQueryRewrite.ConstantScore) @@ -105,7 +106,6 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor .MinimumShouldMatch(2) .QuoteFieldSuffix("'") .Lenient() - .Locale("en_US") .Timezone("root") ); #pragma warning restore 618 // usage of lowercase_expanded_terms and locale diff --git a/src/Tests/QueryDsl/Geo/Distance/GeoDistanceQueryUsageTests.cs b/src/Tests/QueryDsl/Geo/Distance/GeoDistanceQueryUsageTests.cs index 5b516129211..eb55451b3b9 100644 --- a/src/Tests/QueryDsl/Geo/Distance/GeoDistanceQueryUsageTests.cs +++ b/src/Tests/QueryDsl/Geo/Distance/GeoDistanceQueryUsageTests.cs @@ -35,10 +35,13 @@ public GeoDistanceQueryUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base DistanceType = GeoDistanceType.Arc, Location = new GeoLocation(34,-34), Distance = "200.0m", +#pragma warning disable 618 OptimizeBoundingBox = GeoOptimizeBBox.Memory, +#pragma warning restore 618 ValidationMethod = GeoValidationMethod.IgnoreMalformed }; +#pragma warning disable 618 // use of GeoOptimizeBBox protected override QueryContainer QueryFluent(QueryContainerDescriptor q) => q .GeoDistance(g=>g .Boost(1.1) @@ -50,6 +53,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor .Optimize(GeoOptimizeBBox.Memory) .ValidationMethod(GeoValidationMethod.IgnoreMalformed) ); +#pragma warning restore 618 protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen(a => a.GeoDistance) { diff --git a/src/Tests/QueryDsl/Geo/DistanceRange/GeoDistanceRangeQueryUsageTests.cs b/src/Tests/QueryDsl/Geo/DistanceRange/GeoDistanceRangeQueryUsageTests.cs index 9eb68f30446..d3d27448ed0 100644 --- a/src/Tests/QueryDsl/Geo/DistanceRange/GeoDistanceRangeQueryUsageTests.cs +++ b/src/Tests/QueryDsl/Geo/DistanceRange/GeoDistanceRangeQueryUsageTests.cs @@ -2,6 +2,7 @@ using Tests.Framework.Integration; using Tests.Framework.ManagedElasticsearch.Clusters; using Tests.Framework.MockData; +#pragma warning disable 618 namespace Tests.QueryDsl.Geo.DistanceRange { diff --git a/src/Tests/QueryDsl/Specialized/Script/ScriptQueryUsageTests.cs b/src/Tests/QueryDsl/Specialized/Script/ScriptQueryUsageTests.cs index b3da925bcb7..9cffd4af16b 100644 --- a/src/Tests/QueryDsl/Specialized/Script/ScriptQueryUsageTests.cs +++ b/src/Tests/QueryDsl/Specialized/Script/ScriptQueryUsageTests.cs @@ -61,12 +61,16 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor q => { q.Inline = ""; q.Id = null; +#pragma warning disable 618 q.File = ""; +#pragma warning restore 618 }, q => { q.Inline = null; q.Id = null; +#pragma warning disable 618 q.File = null; +#pragma warning restore 618 } }; } diff --git a/src/Tests/QueryDsl/Specialized/Template/TemplateQueryUsageTests.cs b/src/Tests/QueryDsl/Specialized/Template/TemplateQueryUsageTests.cs index 6ab196edce5..6a96ae9fdd9 100644 --- a/src/Tests/QueryDsl/Specialized/Template/TemplateQueryUsageTests.cs +++ b/src/Tests/QueryDsl/Specialized/Template/TemplateQueryUsageTests.cs @@ -3,6 +3,7 @@ using Tests.Framework.Integration; using Tests.Framework.ManagedElasticsearch.Clusters; using Tests.Framework.MockData; +#pragma warning disable 618 namespace Tests.QueryDsl.Specialized.Template { @@ -37,7 +38,6 @@ public TemplateQueryUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, } }; -#pragma warning disable 618 protected override QueryContainer QueryFluent(QueryContainerDescriptor q) => q .Template(sn => sn .Name("named_query") @@ -45,7 +45,6 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor .Inline(_templateString) .Params(p=>p.Add("query_string", "all about search")) ); -#pragma warning restore 618 protected override ConditionlessWhen ConditionlessWhen => new ConditionlessWhen(a => a.Template) { diff --git a/src/Tests/Reproduce/GithubIssue2306.cs b/src/Tests/Reproduce/GithubIssue2306.cs index f8fdf249a83..aa70d43429e 100644 --- a/src/Tests/Reproduce/GithubIssue2306.cs +++ b/src/Tests/Reproduce/GithubIssue2306.cs @@ -24,7 +24,9 @@ public void DeleteNonExistentDocumentReturnsNotFound() var response = client.Delete("non-existent-id"); response.ShouldBeValid(); +#pragma warning disable 618 response.Found.Should().BeFalse(); +#pragma warning restore 618 response.Result.Should().Be(Result.NotFound); response.Index.Should().Be("project"); response.Type.Should().Be("project"); diff --git a/src/Tests/Search/FieldStats/FieldStatsApiTests.cs b/src/Tests/Search/FieldStats/FieldStatsApiTests.cs index 8ae66897840..6c56ea5881e 100644 --- a/src/Tests/Search/FieldStats/FieldStatsApiTests.cs +++ b/src/Tests/Search/FieldStats/FieldStatsApiTests.cs @@ -9,6 +9,7 @@ using Tests.Framework.MockData; using Xunit; using static Nest.Infer; +#pragma warning disable 618 namespace Tests.Search.FieldStats { diff --git a/src/Tests/Search/FieldStats/FieldStatsUrlTests.cs b/src/Tests/Search/FieldStats/FieldStatsUrlTests.cs index 5c5b1297872..e3d6774d47f 100644 --- a/src/Tests/Search/FieldStats/FieldStatsUrlTests.cs +++ b/src/Tests/Search/FieldStats/FieldStatsUrlTests.cs @@ -3,6 +3,7 @@ using Tests.Framework; using Tests.Framework.MockData; using static Tests.Framework.UrlTester; +#pragma warning disable 618 namespace Tests.Search.FieldStats { diff --git a/src/Tests/Search/MultiSearch/MultiSearchTemplate/MultiSearchTemplateApiTests.cs b/src/Tests/Search/MultiSearch/MultiSearchTemplate/MultiSearchTemplateApiTests.cs index 95268af16da..503c6d54822 100644 --- a/src/Tests/Search/MultiSearch/MultiSearchTemplate/MultiSearchTemplateApiTests.cs +++ b/src/Tests/Search/MultiSearch/MultiSearchTemplate/MultiSearchTemplateApiTests.cs @@ -53,7 +53,9 @@ protected override LazyResponses ClientUsage() => Calls( ) ) .Template("id", s => s.Index("devs").Id("template-id")) +#pragma warning disable 618 .Template("file", s => s.Index("devs").File("template-file")); +#pragma warning restore 618 protected override MultiSearchTemplateRequest Initializer => new MultiSearchTemplateRequest(typeof(Project), typeof(Project)) { @@ -69,7 +71,9 @@ protected override LazyResponses ClientUsage() => Calls( } }, { "id", new SearchTemplateRequest("devs") { Id = "template-id" } }, +#pragma warning disable 618 { "file", new SearchTemplateRequest("devs") { File = "template-file" } } +#pragma warning restore 618 } }; diff --git a/src/Tests/Search/Request/ProfileUsageTests.cs b/src/Tests/Search/Request/ProfileUsageTests.cs index e6f5e2806a6..bdd13f42e00 100644 --- a/src/Tests/Search/Request/ProfileUsageTests.cs +++ b/src/Tests/Search/Request/ProfileUsageTests.cs @@ -79,7 +79,9 @@ [I] public async Task ProfileResults() => await AssertOnAllResponses((r) => var firstCollector = firstSearch.Collector.First(); firstCollector.Name.Should().NotBeNullOrEmpty(); firstCollector.Reason.Should().NotBeNullOrEmpty(); +#pragma warning disable 618 firstCollector.Time.Should().BeGreaterOrEqualTo(TimeSpan.FromMilliseconds(0.000001)); +#pragma warning restore 618 }); } } diff --git a/src/Tests/Search/Request/SuggestUsageTests.cs b/src/Tests/Search/Request/SuggestUsageTests.cs index 3ba21416046..62a7aadca69 100644 --- a/src/Tests/Search/Request/SuggestUsageTests.cs +++ b/src/Tests/Search/Request/SuggestUsageTests.cs @@ -193,7 +193,9 @@ public SuggestUsageTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cl { Collate = new PhraseSuggestCollate { +#pragma warning disable 618 Query = new TemplateQuery +#pragma warning restore 618 { Inline = "{ \"match\": { \"{{field_name}}\": \"{{suggestion}}\" }}", }, diff --git a/src/Tests/Search/Search/SearchProfileApiTests.cs b/src/Tests/Search/Search/SearchProfileApiTests.cs index 3200165935e..a7fb793c8ba 100644 --- a/src/Tests/Search/Search/SearchProfileApiTests.cs +++ b/src/Tests/Search/Search/SearchProfileApiTests.cs @@ -81,7 +81,9 @@ protected override void ExpectResponse(ISearchResponse response) { collector.Name.Should().NotBeNullOrEmpty(); collector.Reason.Should().NotBeNullOrEmpty(); +#pragma warning disable 618 collector.Time.Should().NotBeNull(); +#pragma warning restore 618 if (TestClient.VersionUnderTestSatisfiedBy(">=5.3.0")) collector.TimeInNanoseconds.Should().BeGreaterThan(0); var children = collector.Children; @@ -91,7 +93,9 @@ protected override void ExpectResponse(ISearchResponse response) child.Should().NotBeNull(); child.Name.Should().NotBeNullOrEmpty(); child.Reason.Should().NotBeNullOrEmpty(); +#pragma warning disable 618 child.Time.Should().NotBeNull(); +#pragma warning restore 618 if (TestClient.VersionUnderTestSatisfiedBy(">=5.3.0")) child.TimeInNanoseconds.Should().BeGreaterThan(0); var grandchildren = child.Children; @@ -100,7 +104,9 @@ protected override void ExpectResponse(ISearchResponse response) { grandchild.Name.Should().NotBeNullOrEmpty(); grandchild.Reason.Should().NotBeNullOrEmpty(); +#pragma warning disable 618 grandchild.Time.Should().NotBeNull(); +#pragma warning restore 618 if (TestClient.VersionUnderTestSatisfiedBy(">=5.3.0")) grandchild.TimeInNanoseconds.Should().BeGreaterThan(0); } diff --git a/src/Tests/Search/SearchTemplate/PutSearchTemplate/PutSearchTemplateApiTests.cs b/src/Tests/Search/SearchTemplate/PutSearchTemplate/PutSearchTemplateApiTests.cs index 0d4866a8a12..d96b74b9d8f 100644 --- a/src/Tests/Search/SearchTemplate/PutSearchTemplate/PutSearchTemplateApiTests.cs +++ b/src/Tests/Search/SearchTemplate/PutSearchTemplate/PutSearchTemplateApiTests.cs @@ -5,6 +5,7 @@ using Tests.Framework.Integration; using Tests.Framework.ManagedElasticsearch.Clusters; using Xunit; +#pragma warning disable 618 // PutSearchTemplate is deleted in 6.x namespace Tests.Search.SearchTemplate.PutSearchTemplate { diff --git a/src/Tests/Search/SearchTemplate/PutSearchTemplate/PutSearchTemplateUrlTests.cs b/src/Tests/Search/SearchTemplate/PutSearchTemplate/PutSearchTemplateUrlTests.cs index b8c6fbe5da0..0d30966a506 100644 --- a/src/Tests/Search/SearchTemplate/PutSearchTemplate/PutSearchTemplateUrlTests.cs +++ b/src/Tests/Search/SearchTemplate/PutSearchTemplate/PutSearchTemplateUrlTests.cs @@ -2,6 +2,7 @@ using Nest; using Tests.Framework; using static Tests.Framework.UrlTester; +#pragma warning disable 618 namespace Tests.Search.SearchTemplate.PutSearchTemplate { diff --git a/src/Tests/Search/SearchTemplate/SearchTemplateCrudTests.cs b/src/Tests/Search/SearchTemplate/SearchTemplateCrudTests.cs index 89592684afa..6cf75ba2841 100644 --- a/src/Tests/Search/SearchTemplate/SearchTemplateCrudTests.cs +++ b/src/Tests/Search/SearchTemplate/SearchTemplateCrudTests.cs @@ -4,6 +4,7 @@ using Tests.Framework.Integration; using Tests.Framework.ManagedElasticsearch.Clusters; using Xunit; +#pragma warning disable 618 namespace Tests.Search.SearchTemplate { diff --git a/src/Tests/Search/Suggesters/SuggestApiTests.cs b/src/Tests/Search/Suggesters/SuggestApiTests.cs index 91f14e86420..9ee5137a210 100644 --- a/src/Tests/Search/Suggesters/SuggestApiTests.cs +++ b/src/Tests/Search/Suggesters/SuggestApiTests.cs @@ -17,7 +17,7 @@ namespace Tests.Search.Suggesters */ public class SuggestApiTests - : ApiIntegrationTestBase, ISuggestRequest, SuggestDescriptor, SuggestRequest> + : ApiIntegrationTestBase, ISearchRequest, SearchDescriptor, SearchRequest> { private string _phraseSuggestField = "description.shingle"; @@ -26,79 +26,79 @@ public SuggestApiTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(clus } protected override LazyResponses ClientUsage() => Calls( -#pragma warning disable 618 - fluent: (c, f) => c.Suggest(f), - fluentAsync: (c, f) => c.SuggestAsync(f), - request: (c, r) => c.Suggest(r), - requestAsync: (c, r) => c.SuggestAsync(r) -#pragma warning restore 618 + fluent: (c, f) => c.Search(f), + fluentAsync: (c, f) => c.SearchAsync(f), + request: (c, r) => c.Search(r), + requestAsync: (c, r) => c.SearchAsync(r) ); protected override int ExpectStatusCode => 200; protected override bool ExpectIsValid => true; protected override HttpMethod HttpMethod => HttpMethod.POST; - protected override string UrlPath => "/project/_suggest"; + protected override string UrlPath => "/project/project/_search"; protected override bool SupportsDeserialization => false; - protected override Func, ISuggestRequest> Fluent => s => s - .Term("my-term-suggest", t => t - .MaxEdits(1) - .MaxInspections(20) - .MaxTermFrequency(300000) - .MinDocFrequency(1) - .MinWordLength(2) - .PrefixLength(1) - .SuggestMode(SuggestMode.Always) - .Analyzer("standard") - .Field(p => p.Description) - .ShardSize(7) - .Size(8) - .Text(SuggestText) - ) - .Completion("my-completion-suggest", c => c - .Contexts(ctxs => ctxs - .Context("color", ctx => ctx.Context(Project.First.Suggest.Contexts.Values.SelectMany(v => v).First())) - ) - .Fuzzy(f => f - .Fuzziness(Fuzziness.Auto) - .MinLength(1) - .PrefixLength(2) - .Transpositions() - .UnicodeAware(false) + protected override Func, ISearchRequest> Fluent => s => s + .Suggest(su => su + .Term("my-term-suggest", t => t + .MaxEdits(1) + .MaxInspections(20) + .MaxTermFrequency(300000) + .MinDocFrequency(1) + .MinWordLength(2) + .PrefixLength(1) + .SuggestMode(SuggestMode.Always) + .Analyzer("standard") + .Field(p => p.Description) + .ShardSize(7) + .Size(8) + .Text(SuggestText) ) - .Analyzer("simple") - .Field(p => p.Suggest) - .Size(8) - .Prefix(Project.First.Name) - ) - .Phrase("my-phrase-suggest", ph => ph - .Text(PhraseSuggest) - .Field(p => p.Description.Suffix("shingle")) - .GramSize(4) - .RealWordErrorLikelihood(0.95) - .MaxErrors(1) - .Confidence(1) - .Collate(c => c - .Query(q => q - .Inline("{ \"match\": { \"{{field_name}}\" : \"{{suggestion}}\" }}") + .Completion("my-completion-suggest", c => c + .Contexts(ctxs => ctxs + .Context("color", ctx => ctx.Context(Project.First.Suggest.Contexts.Values.SelectMany(v => v).First())) ) - .Params(p => p.Add("field_name", _phraseSuggestField)) - .Prune() + .Fuzzy(f => f + .Fuzziness(Fuzziness.Auto) + .MinLength(1) + .PrefixLength(2) + .Transpositions() + .UnicodeAware(false) + ) + .Analyzer("simple") + .Field(p => p.Suggest) + .Size(8) + .Prefix(Project.First.Name) ) - .DirectGenerator(d => d + .Phrase("my-phrase-suggest", ph => ph + .Text(PhraseSuggest) .Field(p => p.Description.Suffix("shingle")) - ) - .Highlight(h => h - .PreTag("") - .PostTag("") - ) - .Smoothing(smoothing => smoothing - .StupidBackoff(b => b.Discount(0.4)) + .GramSize(4) + .RealWordErrorLikelihood(0.95) + .MaxErrors(1) + .Confidence(1) + .Collate(c => c + .Query(q => q + .Inline("{ \"match\": { \"{{field_name}}\" : \"{{suggestion}}\" }}") + ) + .Params(p => p.Add("field_name", _phraseSuggestField)) + .Prune() + ) + .DirectGenerator(d => d + .Field(p => p.Description.Suffix("shingle")) + ) + .Highlight(h => h + .PreTag("") + .PostTag("") + ) + .Smoothing(smoothing => smoothing + .StupidBackoff(b => b.Discount(0.4)) + ) ) ); - protected override SuggestRequest Initializer => - new SuggestRequest + protected override SearchRequest Initializer => + new SearchRequest { Suggest = new SuggestContainer { @@ -168,7 +168,9 @@ protected override LazyResponses ClientUsage() => Calls( Confidence = 1.0, Collate = new PhraseSuggestCollate { +#pragma warning disable 618 Query = new TemplateQuery +#pragma warning restore 618 { Inline = "{ \"match\": { \"{{field_name}}\" : \"{{suggestion}}\" }}", }, @@ -212,7 +214,7 @@ private static string PhraseSuggest } - protected override void ExpectResponse(ISuggestResponse response) + protected override void ExpectResponse(ISearchResponse response) { /** === Handling Responses * Get the suggestions for a suggester by indexing into @@ -223,9 +225,9 @@ protected override void ExpectResponse(ISuggestResponse response) AssertPhraseSuggestResponse(response); } - private static void AssertPhraseSuggestResponse(ISuggestResponse response) + private static void AssertPhraseSuggestResponse(ISearchResponse response) { - var myTermSuggest = response.Suggestions["my-phrase-suggest"]; + var myTermSuggest = response.Suggest["my-phrase-suggest"]; myTermSuggest.Should().NotBeNull(); var suggest = myTermSuggest.First(); @@ -242,9 +244,9 @@ private static void AssertPhraseSuggestResponse(ISuggestResponse respon } } - private static void AssertTermSuggestResponse(ISuggestResponse response) + private static void AssertTermSuggestResponse(ISearchResponse response) { - var myTermSuggest = response.Suggestions["my-term-suggest"]; + var myTermSuggest = response.Suggest["my-term-suggest"]; myTermSuggest.Should().NotBeNull(); var suggest = myTermSuggest.First(); @@ -260,9 +262,9 @@ private static void AssertTermSuggestResponse(ISuggestResponse response } } - private static void AssertCompletionSuggestResponse(ISuggestResponse response) + private static void AssertCompletionSuggestResponse(ISearchResponse response) { - var myCompletionSuggest = response.Suggestions["my-completion-suggest"]; + var myCompletionSuggest = response.Suggest["my-completion-suggest"]; myCompletionSuggest.Should().NotBeNull(); var suggest = myCompletionSuggest.First(); @@ -284,85 +286,88 @@ private static void AssertCompletionSuggestResponse(ISuggestResponse re colorContexts.First().Category.Should().Be((Project.First.Suggest.Contexts.Values.SelectMany(v => v).First())); } - protected override object ExpectJson => new Dictionary + protected override object ExpectJson => new { + suggest = new Dictionary { - "my-completion-suggest", new { - completion = new + "my-completion-suggest", new { - analyzer = "simple", - contexts = new + completion = new { - color = new[] + analyzer = "simple", + contexts = new { - new {context = Project.First.Suggest.Contexts.Values.SelectMany(v => v).First()} - } - }, - field = "suggest", - fuzzy = new - { - fuzziness = "AUTO", - min_length = 1, - prefix_length = 2, - transpositions = true, - unicode_aware = false + color = new[] + { + new {context = Project.First.Suggest.Contexts.Values.SelectMany(v => v).First()} + } + }, + field = "suggest", + fuzzy = new + { + fuzziness = "AUTO", + min_length = 1, + prefix_length = 2, + transpositions = true, + unicode_aware = false + }, + size = 8, }, - size = 8, - }, - prefix = Project.Instance.Name - } - }, - { - "my-phrase-suggest", new + prefix = Project.Instance.Name + } + }, { - phrase = new + "my-phrase-suggest", new { - collate = new + phrase = new { - query = new + collate = new { - inline = "{ \"match\": { \"{{field_name}}\" : \"{{suggestion}}\" }}", + query = new + { + inline = "{ \"match\": { \"{{field_name}}\" : \"{{suggestion}}\" }}", + }, + @params = new + { + field_name = _phraseSuggestField + }, + prune = true, }, - @params = new + confidence = 1.0, + max_errors = 1.0, + direct_generator = new[] { - field_name = _phraseSuggestField + new {field = _phraseSuggestField} }, - prune = true, + highlight = new {post_tag = "", pre_tag = ""}, + smoothing = new { stupid_backoff = new { discount = 0.4 }}, + field = _phraseSuggestField, + gram_size = 4, + real_word_error_likelihood = 0.95 }, - confidence = 1.0, - max_errors = 1.0, - direct_generator = new[] - { - new {field = _phraseSuggestField} - }, - highlight = new {post_tag = "", pre_tag = ""}, - smoothing = new { stupid_backoff = new { discount = 0.4 }}, - field = _phraseSuggestField, - gram_size = 4, - real_word_error_likelihood = 0.95 - }, - text = PhraseSuggest - } - }, - { - "my-term-suggest", new + text = PhraseSuggest + } + }, { - term = new + "my-term-suggest", new { - analyzer = "standard", - field = "description", - max_edits = 1, - max_inspections = 20, - max_term_freq = 300000.0, - min_doc_freq = 1.0, - min_word_length = 2, - prefix_length = 1, - shard_size = 7, - size = 8, - suggest_mode = "always" - }, - text = SuggestText + term = new + { + analyzer = "standard", + field = "description", + max_edits = 1, + max_inspections = 20, + max_term_freq = 300000.0, + min_doc_freq = 1.0, + min_word_length = 2, + prefix_length = 1, + shard_size = 7, + size = 8, + suggest_mode = "always" + }, + text = SuggestText + } } } };