Skip to content

Commit

Permalink
Remove generated [Obsolete] parameters (#3659)
Browse files Browse the repository at this point in the history
This commit removes the generated obsolete parameters through code generation.
Relates: elastic/elasticsearch#41098
  • Loading branch information
russcam authored Apr 11, 2019
1 parent d1e1627 commit c60cc3b
Show file tree
Hide file tree
Showing 38 changed files with 22 additions and 431 deletions.
2 changes: 2 additions & 0 deletions src/CodeGeneration/ApiGenerator/Overrides/GlobalOverrides.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public class GlobalOverrides : EndpointOverridesBase

public override IEnumerable<string> SkipQueryStringParams { get; } = new[]
{
"parent", //can be removed once https://github.com/elastic/elasticsearch/pull/41098 is in
"copy_settings", //this still needs a PR?
"source", // allows the body to be specified as a request param, we do not want to advertise this with a strongly typed method
"ttl",
"timestamp",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,9 +609,6 @@ public class CreateRequestParameters : RequestParameters<CreateRequestParameters
/// shard (number of replicas + 1)
///</summary>
public string WaitForActiveShards { get => Q<string>("wait_for_active_shards"); set => Q("wait_for_active_shards", value); }
///<summary>ID of the parent document</summary>
[Obsolete("Scheduled to be removed in 7.0, the parent parameter has been deprecated from elasticsearch, please use routing instead directly.")]
public string Parent { get => Q<string>("parent"); set => Q("parent", value); }
///<summary>
/// If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this
/// operation visible to search, if `false` (the default) then do nothing with refreshes.
Expand All @@ -638,9 +635,6 @@ public class DeleteRequestParameters : RequestParameters<DeleteRequestParameters
/// shard (number of replicas + 1)
///</summary>
public string WaitForActiveShards { get => Q<string>("wait_for_active_shards"); set => Q("wait_for_active_shards", value); }
///<summary>ID of parent document</summary>
[Obsolete("Scheduled to be removed in 7.0, the parent parameter has been deprecated from elasticsearch, please use routing instead directly.")]
public string Parent { get => Q<string>("parent"); set => Q("parent", value); }
///<summary>
/// If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this
/// operation visible to search, if `false` (the default) then do nothing with refreshes.
Expand Down Expand Up @@ -757,9 +751,6 @@ public class DocumentExistsRequestParameters : RequestParameters<DocumentExistsR
public override HttpMethod DefaultHttpMethod => HttpMethod.HEAD;
///<summary>A comma-separated list of stored fields to return in the response</summary>
public string[] StoredFields { get => Q<string[]>("stored_fields"); set => Q("stored_fields", value); }
///<summary>The ID of the parent document</summary>
[Obsolete("Scheduled to be removed in 7.0, the parent parameter has been deprecated from elasticsearch, please use routing instead directly.")]
public string Parent { get => Q<string>("parent"); set => Q("parent", value); }
///<summary>Specify the node or shard the operation should be performed on (default: random)</summary>
public string Preference { get => Q<string>("preference"); set => Q("preference", value); }
///<summary>Specify whether to perform the operation in realtime or search mode</summary>
Expand All @@ -783,9 +774,6 @@ public class DocumentExistsRequestParameters : RequestParameters<DocumentExistsR
public class SourceExistsRequestParameters : RequestParameters<SourceExistsRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.HEAD;
///<summary>The ID of the parent document</summary>
[Obsolete("Scheduled to be removed in 7.0, the parent parameter has been deprecated from elasticsearch, please use routing instead directly.")]
public string Parent { get => Q<string>("parent"); set => Q("parent", value); }
///<summary>Specify the node or shard the operation should be performed on (default: random)</summary>
public string Preference { get => Q<string>("preference"); set => Q("preference", value); }
///<summary>Specify whether to perform the operation in realtime or search mode</summary>
Expand Down Expand Up @@ -821,9 +809,6 @@ public class ExplainRequestParameters : RequestParameters<ExplainRequestParamete
public string[] StoredFields { get => Q<string[]>("stored_fields"); set => Q("stored_fields", value); }
///<summary>Specify whether format-based query failures (such as providing text to a numeric field) should be ignored</summary>
public bool? Lenient { get => Q<bool?>("lenient"); set => Q("lenient", value); }
///<summary>The ID of the parent document</summary>
[Obsolete("Scheduled to be removed in 7.0, the parent parameter has been deprecated from elasticsearch, please use routing instead directly.")]
public string Parent { get => Q<string>("parent"); set => Q("parent", value); }
///<summary>Specify the node or shard the operation should be performed on (default: random)</summary>
public string Preference { get => Q<string>("preference"); set => Q("preference", value); }
///<summary>Query in the Lucene query string syntax</summary>
Expand Down Expand Up @@ -859,9 +844,6 @@ public class GetRequestParameters : RequestParameters<GetRequestParameters>
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
///<summary>A comma-separated list of stored fields to return in the response</summary>
public string[] StoredFields { get => Q<string[]>("stored_fields"); set => Q("stored_fields", value); }
///<summary>The ID of the parent document</summary>
[Obsolete("Scheduled to be removed in 7.0, the parent parameter has been deprecated from elasticsearch, please use routing instead directly.")]
public string Parent { get => Q<string>("parent"); set => Q("parent", value); }
///<summary>Specify the node or shard the operation should be performed on (default: random)</summary>
public string Preference { get => Q<string>("preference"); set => Q("preference", value); }
///<summary>Specify whether to perform the operation in realtime or search mode</summary>
Expand Down Expand Up @@ -892,9 +874,6 @@ public class GetScriptRequestParameters : RequestParameters<GetScriptRequestPara
public class SourceRequestParameters : RequestParameters<SourceRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;
///<summary>The ID of the parent document</summary>
[Obsolete("Scheduled to be removed in 7.0, the parent parameter has been deprecated from elasticsearch, please use routing instead directly.")]
public string Parent { get => Q<string>("parent"); set => Q("parent", value); }
///<summary>Specify the node or shard the operation should be performed on (default: random)</summary>
public string Preference { get => Q<string>("preference"); set => Q("preference", value); }
///<summary>Specify whether to perform the operation in realtime or search mode</summary>
Expand Down Expand Up @@ -926,9 +905,6 @@ public class IndexRequestParameters : RequestParameters<IndexRequestParameters>
public string WaitForActiveShards { get => Q<string>("wait_for_active_shards"); set => Q("wait_for_active_shards", value); }
///<summary>Explicit operation type</summary>
public OpType? OpType { get => Q<OpType?>("op_type"); set => Q("op_type", value); }
///<summary>ID of the parent document</summary>
[Obsolete("Scheduled to be removed in 7.0, the parent parameter has been deprecated from elasticsearch, please use routing instead directly.")]
public string Parent { get => Q<string>("parent"); set => Q("parent", value); }
///<summary>
/// If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this
/// operation visible to search, if `false` (the default) then do nothing with refreshes.
Expand Down Expand Up @@ -1448,9 +1424,6 @@ public class IndicesShardStoresRequestParameters : RequestParameters<IndicesShar
public class ShrinkIndexRequestParameters : RequestParameters<ShrinkIndexRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT;
///<summary>whether or not to copy settings from the source index (defaults to false)</summary>
[Obsolete("Scheduled to be removed in 7.0, Elasticsearch 6.4 will throw an exception if this is turned off see elastic/elasticsearch#30404")]
public bool? CopySettings { get => Q<bool?>("copy_settings"); set => Q("copy_settings", value); }
///<summary>Explicit operation timeout</summary>
public TimeSpan Timeout { get => Q<TimeSpan>("timeout"); set => Q("timeout", value); }
///<summary>Specify timeout for connection to master</summary>
Expand All @@ -1462,9 +1435,6 @@ public class ShrinkIndexRequestParameters : RequestParameters<ShrinkIndexRequest
public class SplitIndexRequestParameters : RequestParameters<SplitIndexRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.PUT;
///<summary>whether or not to copy settings from the source index (defaults to false)</summary>
[Obsolete("Scheduled to be removed in 7.0, Elasticsearch 6.4 will throw an exception if this is turned off see elastic/elasticsearch#30404")]
public bool? CopySettings { get => Q<bool?>("copy_settings"); set => Q("copy_settings", value); }
///<summary>Explicit operation timeout</summary>
public TimeSpan Timeout { get => Q<TimeSpan>("timeout"); set => Q("timeout", value); }
///<summary>Specify timeout for connection to master</summary>
Expand Down Expand Up @@ -1682,9 +1652,6 @@ public class MultiTermVectorsRequestParameters : RequestParameters<MultiTermVect
public string Preference { get => Q<string>("preference"); set => Q("preference", value); }
///<summary>Specific routing value. Applies to all returned documents unless otherwise specified in body "params" or "docs".</summary>
public string Routing { get => Q<string>("routing"); set => Q("routing", value); }
///<summary>Parent id of documents. Applies to all returned documents unless otherwise specified in body "params" or "docs".</summary>
[Obsolete("Scheduled to be removed in 7.0, the parent parameter has been deprecated from elasticsearch, please use routing instead directly.")]
public string Parent { get => Q<string>("parent"); set => Q("parent", value); }
///<summary>Specifies if requests are real-time as opposed to near-real-time (default: true).</summary>
public bool? Realtime { get => Q<bool?>("realtime"); set => Q("realtime", value); }
///<summary>Explicit version number for concurrency control</summary>
Expand Down Expand Up @@ -2097,9 +2064,6 @@ public class TermVectorsRequestParameters : RequestParameters<TermVectorsRequest
public string Preference { get => Q<string>("preference"); set => Q("preference", value); }
///<summary>Specific routing value.</summary>
public string Routing { get => Q<string>("routing"); set => Q("routing", value); }
///<summary>Parent id of documents.</summary>
[Obsolete("Scheduled to be removed in 7.0, the parent parameter has been deprecated from elasticsearch, please use routing instead directly.")]
public string Parent { get => Q<string>("parent"); set => Q("parent", value); }
///<summary>Specifies if request is real-time as opposed to near-real-time (default: true).</summary>
public bool? Realtime { get => Q<bool?>("realtime"); set => Q("realtime", value); }
///<summary>Explicit version number for concurrency control</summary>
Expand All @@ -2121,9 +2085,6 @@ public class UpdateRequestParameters : RequestParameters<UpdateRequestParameters
public bool? SourceEnabled { get => Q<bool?>("_source"); set => Q("_source", value); }
///<summary>The script language (default: painless)</summary>
public string Lang { get => Q<string>("lang"); set => Q("lang", value); }
///<summary>ID of the parent document. Is is only used for routing and when for the upsert request</summary>
[Obsolete("Scheduled to be removed in 7.0, the parent parameter has been deprecated from elasticsearch, please use routing instead directly.")]
public string Parent { get => Q<string>("parent"); set => Q("parent", value); }
///<summary>
/// If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this
/// operation visible to search, if `false` (the default) then do nothing with refreshes.
Expand Down
8 changes: 0 additions & 8 deletions src/Elasticsearch.Net/Extensions/Fluent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ namespace Elasticsearch.Net
{
internal static class Fluent
{
[Obsolete("Use the overload that accepts TValue")]
internal static TDescriptor Assign<TDescriptor, TInterface>(TDescriptor self, Action<TInterface> assign)
where TDescriptor : class, TInterface
{
assign(self);
return self;
}

internal static TDescriptor Assign<TDescriptor, TInterface, TValue>(TDescriptor self, TValue value, Action<TInterface, TValue> assign)
where TDescriptor : class, TInterface
{
Expand Down
4 changes: 0 additions & 4 deletions src/Nest/Aggregations/Bucket/BucketAggregation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ public abstract class BucketAggregationDescriptorBase<TBucketAggregation, TBucke

string IAggregation.Name { get; set; }

[Obsolete("Use the overload that accepts TValue")]
protected TBucketAggregation Assign(Action<TBucketAggregationInterface> assigner) =>
Fluent.Assign((TBucketAggregation)this, assigner);

protected TBucketAggregation Assign<TValue>(TValue value, Action<TBucketAggregationInterface, TValue> assigner) =>
Fluent.Assign((TBucketAggregation)this, value, assigner);

Expand Down
6 changes: 0 additions & 6 deletions src/Nest/Aggregations/Bucket/Terms/TermsOrder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,5 @@ public class TermsOrder : ISortOrder
public static TermsOrder KeyAscending => new TermsOrder { Key = "_key", Order = SortOrder.Ascending };
public static TermsOrder KeyDescending => new TermsOrder { Key = "_key", Order = SortOrder.Descending };
public SortOrder Order { get; set; }

[Obsolete("Deprecated in Elasticsearch 6.0. Use KeyAscending")]
public static TermsOrder TermAscending => new TermsOrder { Key = "_key", Order = SortOrder.Ascending };

[Obsolete("Deprecated in Elasticsearch 6.0. Use KeyDescending")]
public static TermsOrder TermDescending => new TermsOrder { Key = "_key", Order = SortOrder.Descending };
}
}
14 changes: 0 additions & 14 deletions src/Nest/Analysis/TokenFilters/Synonym/SynonymGraphTokenFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ public interface ISynonymGraphTokenFilter : ITokenFilter
[DataMember(Name ="format")]
SynonymFormat? Format { get; set; }

[DataMember(Name ="ignore_case")]
[Obsolete("Will be removed in Elasticsearch 7.x, if you need to ignore case add a lowercase filter before this synonym filter")]
[JsonFormatter(typeof(NullableStringBooleanFormatter))]
bool? IgnoreCase { get; set; }

/// <inheritdoc cref="ISynonymTokenFilter.Lenient" />
[DataMember(Name ="lenient")]
[JsonFormatter(typeof(NullableStringBooleanFormatter))]
Expand Down Expand Up @@ -52,10 +47,6 @@ public SynonymGraphTokenFilter() : base("synonym_graph") { }
/// <inheritdoc />
public SynonymFormat? Format { get; set; }

/// <inheritdoc />
[Obsolete("Will be removed in Elasticsearch 7.x, if you need to ignore case add a lowercase filter before this synonym filter")]
public bool? IgnoreCase { get; set; }

/// <inheritdoc cref="ISynonymTokenFilter.Lenient" />
public bool? Lenient { get; set; }

Expand All @@ -77,17 +68,12 @@ public class SynonymGraphTokenFilterDescriptor
bool? ISynonymGraphTokenFilter.Expand { get; set; }
SynonymFormat? ISynonymGraphTokenFilter.Format { get; set; }

bool? ISynonymGraphTokenFilter.IgnoreCase { get; set; }
bool? ISynonymGraphTokenFilter.Lenient { get; set; }

IEnumerable<string> ISynonymGraphTokenFilter.Synonyms { get; set; }
string ISynonymGraphTokenFilter.SynonymsPath { get; set; }
string ISynonymGraphTokenFilter.Tokenizer { get; set; }

/// <inheritdoc />
[Obsolete("Will be removed in Elasticsearch 7.x, if you need to ignore case add a lowercase filter before this synonym filter")]
public SynonymGraphTokenFilterDescriptor IgnoreCase(bool? ignoreCase = true) => Assign(ignoreCase, (a, v) => a.IgnoreCase = v);

/// <inheritdoc />
public SynonymGraphTokenFilterDescriptor Expand(bool? expand = true) => Assign(expand, (a, v) => a.Expand = v);

Expand Down
17 changes: 1 addition & 16 deletions src/Nest/Analysis/TokenFilters/Synonym/SynonymTokenFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,9 @@ public interface ISynonymTokenFilter : ITokenFilter
[DataMember(Name ="format")]
SynonymFormat? Format { get; set; }

[DataMember(Name ="ignore_case")]
[Obsolete("Will be removed in Elasticsearch 7.x, if you need to ignore case add a lowercase filter before this synonym filter")]
[JsonFormatter(typeof(NullableStringBooleanFormatter))]
bool? IgnoreCase { get; set; }

/// <summary>
/// If `true` ignores exceptions while parsing the synonym configuration. It is important
// to note that only those synonym rules which cannot get parsed are ignored.
/// to note that only those synonym rules which cannot get parsed are ignored.
/// </summary>
[DataMember(Name ="lenient")]
[JsonFormatter(typeof(NullableStringBooleanFormatter))]
Expand Down Expand Up @@ -54,10 +49,6 @@ public SynonymTokenFilter() : base("synonym") { }
/// <inheritdoc />
public SynonymFormat? Format { get; set; }

/// <inheritdoc />
[Obsolete("Will be removed in Elasticsearch 7.x, if you need to ignore case add a lowercase filter before this synonym filter")]
public bool? IgnoreCase { get; set; }

/// <inheritdoc cref="ISynonymTokenFilter.Lenient" />
public bool? Lenient { get; set; }

Expand All @@ -78,17 +69,11 @@ public class SynonymTokenFilterDescriptor
protected override string Type => "synonym";
bool? ISynonymTokenFilter.Expand { get; set; }
SynonymFormat? ISynonymTokenFilter.Format { get; set; }

bool? ISynonymTokenFilter.IgnoreCase { get; set; }
bool? ISynonymTokenFilter.Lenient { get; set; }
IEnumerable<string> ISynonymTokenFilter.Synonyms { get; set; }
string ISynonymTokenFilter.SynonymsPath { get; set; }
string ISynonymTokenFilter.Tokenizer { get; set; }

/// <inheritdoc />
[Obsolete("Will be removed in Elasticsearch 7.x, if you need to ignore case add a lowercase filter before this synonym filter")]
public SynonymTokenFilterDescriptor IgnoreCase(bool? ignoreCase = true) => Assign(ignoreCase, (a, v) => a.IgnoreCase = v);

/// <inheritdoc />
public SynonymTokenFilterDescriptor Expand(bool? expand = true) => Assign(expand, (a, v) => a.Expand = v);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,6 @@ private void ApplyPropertyMappings<TDocument>(IList<IClrPropertyMapping<TDocumen
/// The mapping can infer the index, type, id and relation name for a given CLR type, as well as control
/// serialization behaviour for CLR properties.
/// </summary>
[Obsolete("Please use " + nameof(DefaultMappingFor))]
public TConnectionSettings InferMappingFor<TDocument>(Func<ClrTypeMappingDescriptor<TDocument>, IClrTypeMapping<TDocument>> selector)
where TDocument : class =>
DefaultMappingFor<TDocument>(selector);

/// <inheritdoc cref="InferMappingFor{TDocument}"/>
public TConnectionSettings DefaultMappingFor<TDocument>(Func<ClrTypeMappingDescriptor<TDocument>, IClrTypeMapping<TDocument>> selector)
where TDocument : class
{
Expand Down
3 changes: 0 additions & 3 deletions src/Nest/CommonAbstractions/Fluent/DescriptorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ public abstract class DescriptorBase<TDescriptor, TInterface> : IDescriptor
[IgnoreDataMember]
protected TInterface Self => _self;

[Obsolete("Use the overload that accepts TValue")]
protected TDescriptor Assign(Action<TInterface> assigner) => Fluent.Assign(_self, assigner);

[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected TDescriptor Assign<TValue>(TValue value, Action<TInterface, TValue> assigner) => Fluent.Assign(_self, value, assigner);

Expand Down
8 changes: 0 additions & 8 deletions src/Nest/CommonAbstractions/Fluent/Fluent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ namespace Nest
{
internal static class Fluent
{
[Obsolete("Use the overload that accepts TValue")]
internal static TDescriptor Assign<TDescriptor, TInterface>(TDescriptor self, Action<TInterface> assign)
where TDescriptor : class, TInterface
{
assign(self);
return self;
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static TDescriptor Assign<TDescriptor, TInterface, TValue>(TDescriptor self, TValue value, Action<TInterface, TValue> assign)
where TDescriptor : class, TInterface
Expand Down
3 changes: 0 additions & 3 deletions src/Nest/CommonAbstractions/Request/RequestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ public abstract partial class RequestDescriptorBase<TDescriptor, TParameters, TI

protected TInterface Self => _descriptor;

[Obsolete("Use the overload that accepts TValue")]
protected TDescriptor Assign(Action<TInterface> assign) => Fluent.Assign(_descriptor, assign);

protected TDescriptor Assign<TValue>(TValue value, Action<TInterface, TValue> assign) => Fluent.Assign(_descriptor, value, assign);

protected TDescriptor AssignParam(Action<TParameters> assigner)
Expand Down
Loading

0 comments on commit c60cc3b

Please sign in to comment.