Skip to content

Obsolete AllField and IndexField #3918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ public IReadOnlyDictionary<Field, IFieldMapping> Deserialize(ref JsonReader read
switch (value)
{
case 0:
#pragma warning disable 618
mapping = formatterResolver.GetFormatter<AllField>()
.Deserialize(ref reader, formatterResolver);
#pragma warning restore 618
break;
case 1:
mapping = formatterResolver.GetFormatter<SourceField>()
Expand All @@ -49,8 +51,10 @@ public IReadOnlyDictionary<Field, IFieldMapping> Deserialize(ref JsonReader read
.Deserialize(ref reader, formatterResolver);
break;
case 3:
#pragma warning disable 618
mapping = formatterResolver.GetFormatter<IndexField>()
.Deserialize(ref reader, formatterResolver);
#pragma warning restore 618
break;
case 4:
mapping = formatterResolver.GetFormatter<SizeField>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public partial interface IPutMappingRequest<TDocument> where TDocument : class {
public partial class PutMappingRequest
{
/// <inheritdoc />
[Obsolete("The _all field is no longer supported in Elasticsearch 7.x and will be removed in the next major release. The value will not be sent in a request. An _all like field can be achieved using copy_to")]
public IAllField AllField { get; set; }

/// <inheritdoc />
Expand All @@ -36,6 +37,7 @@ public partial class PutMappingRequest
public IFieldNamesField FieldNamesField { get; set; }

/// <inheritdoc />
[Obsolete("Configuration for the _index field is no longer supported in Elasticsearch 7.x and will be removed in the next major release.")]
public IIndexField IndexField { get; set; }

/// <inheritdoc />
Expand Down Expand Up @@ -63,12 +65,14 @@ public partial class PutMappingRequest<TDocument> where TDocument : class { }
[DataContract]
public partial class PutMappingDescriptor<TDocument> where TDocument : class
{
[Obsolete("The _all field is no longer supported in Elasticsearch 7.x and will be removed in the next major release. The value will not be sent in a request. An _all like field can be achieved using copy_to")]
IAllField ITypeMapping.AllField { get; set; }
bool? ITypeMapping.DateDetection { get; set; }
Union<bool, DynamicMapping> ITypeMapping.Dynamic { get; set; }
IEnumerable<string> ITypeMapping.DynamicDateFormats { get; set; }
IDynamicTemplateContainer ITypeMapping.DynamicTemplates { get; set; }
IFieldNamesField ITypeMapping.FieldNamesField { get; set; }
[Obsolete("Configuration for the _index field is no longer supported in Elasticsearch 7.x and will be removed in the next major release.")]
IIndexField ITypeMapping.IndexField { get; set; }
IDictionary<string, object> ITypeMapping.Meta { get; set; }
bool? ITypeMapping.NumericDetection { get; set; }
Expand Down Expand Up @@ -102,10 +106,12 @@ public PutMappingDescriptor<TDocument> AutoMap(IPropertyVisitor visitor = null,
public PutMappingDescriptor<TDocument> Dynamic(bool? dynamic = true) => Assign(dynamic, (a, v) => a.Dynamic = v);

/// <inheritdoc cref="ITypeMapping.AllField" />
[Obsolete("The _all field is no longer supported in Elasticsearch 7.x and will be removed in the next major release. The value will not be sent in a request. An _all like field can be achieved using copy_to")]
public PutMappingDescriptor<TDocument> AllField(Func<AllFieldDescriptor, IAllField> allFieldSelector) =>
Assign(allFieldSelector, (a, v) => a.AllField = v?.Invoke(new AllFieldDescriptor()));

/// <inheritdoc cref="ITypeMapping.IndexField" />
[Obsolete("Configuration for the _index field is no longer supported in Elasticsearch 7.x and will be removed in the next major release.")]
public PutMappingDescriptor<TDocument> IndexField(Func<IndexFieldDescriptor, IIndexField> indexFieldSelector) =>
Assign(indexFieldSelector, (a, v) => a.IndexField = v?.Invoke(new IndexFieldDescriptor()));

Expand All @@ -118,6 +124,7 @@ public PutMappingDescriptor<TDocument> DisableSizeField(bool? disabled = true) =
Assign(disabled, (a, v) => a.SizeField = new SizeField { Enabled = !v });

/// <inheritdoc cref="ITypeMapping.IndexField" />
[Obsolete("Configuration for the _index field is no longer supported in Elasticsearch 7.x and will be removed in the next major release.")]
public PutMappingDescriptor<TDocument> DisableIndexField(bool? disabled = true) =>
Assign(disabled, (a, v) => a.IndexField = new IndexField { Enabled = !v });

Expand Down
8 changes: 5 additions & 3 deletions src/Nest/Mapping/Mappings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Nest
/// new features in the future.
/// </pre>
/// </summary>
[Obsolete("Mappings are no longer type dependant, please use TypeMapping directly")]
[Obsolete("Mappings are no longer type dependent, please use TypeMapping directly")]
public class Mappings : ObsoleteMappingsBase, ITypeMapping, IEnumerable<ITypeMapping>
{
private IEnumerable<ITypeMapping> AsEnumerable => new[] { new TypeMapping() };
Expand All @@ -29,7 +29,8 @@ public class Mappings : ObsoleteMappingsBase, ITypeMapping, IEnumerable<ITypeMap

public abstract class ObsoleteMappingsBase : ITypeMapping
{
[DataMember(Name = "_all")]
[IgnoreDataMember]
[Obsolete("The _all field is no longer supported in Elasticsearch 7.x and will be removed in the next major release. The value will not be sent in a request. An _all like field can be achieved using copy_to")]
public IAllField AllField { get => Wrapped.AllField; set => Wrapped.AllField = value; }
[DataMember(Name = "date_detection")]
bool? ITypeMapping.DateDetection { get => Wrapped.DateDetection; set => Wrapped.DateDetection = value; }
Expand All @@ -41,7 +42,8 @@ public abstract class ObsoleteMappingsBase : ITypeMapping
IDynamicTemplateContainer ITypeMapping.DynamicTemplates { get => Wrapped.DynamicTemplates; set => Wrapped.DynamicTemplates = value; }
[DataMember(Name = "_field_names")]
IFieldNamesField ITypeMapping.FieldNamesField { get => Wrapped.FieldNamesField; set => Wrapped.FieldNamesField = value; }
[DataMember(Name = "_index")]
[IgnoreDataMember]
[Obsolete("Configuration for the _index field is no longer supported in Elasticsearch 7.x and will be removed in the next major release.")]
IIndexField ITypeMapping.IndexField { get => Wrapped.IndexField; set => Wrapped.IndexField = value; }
[DataMember(Name = "_meta")]
IDictionary<string, object> ITypeMapping.Meta { get => Wrapped.Meta; set => Wrapped.Meta = value; }
Expand Down
7 changes: 5 additions & 2 deletions src/Nest/Mapping/MetaFields/All/AllField.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System.Runtime.Serialization;
using System;
using System.Runtime.Serialization;

namespace Nest
{
[Obsolete("The _all field is no longer supported in Elasticsearch 7.x and will be removed in the next major release. The value will not be sent in a request. An _all like field can be achieved using copy_to")]
[ReadAs(typeof(AllField))]
public interface IAllField : IFieldMapping
{
Expand Down Expand Up @@ -36,6 +38,7 @@ public interface IAllField : IFieldMapping
bool? StoreTermVectors { get; set; }
}

[Obsolete("The _all field is no longer supported in Elasticsearch 7.x and will be removed in the next major release. The value will not be sent in a request. An _all like field can be achieved using copy_to")]
public class AllField : IAllField
{
public string Analyzer { get; set; }
Expand All @@ -50,7 +53,7 @@ public class AllField : IAllField
public bool? StoreTermVectors { get; set; }
}

//OBSOLETE
[Obsolete("The _all field is no longer supported in Elasticsearch 7.x and will be removed in the next major release. The value will not be sent in a request. An _all like field can be achieved using copy_to")]
public class AllFieldDescriptor
: DescriptorBase<AllFieldDescriptor, IAllField>, IAllField
{
Expand Down
6 changes: 5 additions & 1 deletion src/Nest/Mapping/MetaFields/Index/IndexField.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
using System.Runtime.Serialization;
using System;
using System.Runtime.Serialization;

namespace Nest
{
[Obsolete("Configuration for the _index field is no longer supported in Elasticsearch 7.x and will be removed in the next major release.")]
[ReadAs(typeof(IndexField))]
public interface IIndexField : IFieldMapping
{
[DataMember(Name ="enabled")]
bool? Enabled { get; set; }
}

[Obsolete("Configuration for the _index field is no longer supported in Elasticsearch 7.x and will be removed in the next major release.")]
public class IndexField : IIndexField
{
public bool? Enabled { get; set; }
}

[Obsolete("Configuration for the _index field is no longer supported in Elasticsearch 7.x and will be removed in the next major release.")]
public class IndexFieldDescriptor
: DescriptorBase<IndexFieldDescriptor, IIndexField>, IIndexField
{
Expand Down
Loading