Skip to content

Commit df61c31

Browse files
committed
remove support for fielddata_fields as per elastic/elasticsearch#25566
1 parent 2efa71a commit df61c31

File tree

6 files changed

+6
-88
lines changed

6 files changed

+6
-88
lines changed

src/Nest/Aggregations/Metric/TopHits/TopHitsAggregation.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ public interface ITopHitsAggregation : IMetricAggregation
3030
[JsonConverter(typeof(ReadAsTypeJsonConverter<ScriptFields>))]
3131
IScriptFields ScriptFields { get; set; }
3232

33-
[JsonProperty("fielddata_fields")]
34-
Fields FielddataFields { get; set; }
35-
3633
[JsonProperty("stored_fields")]
3734
Fields StoredFields { get; set; }
3835

@@ -52,7 +49,6 @@ public class TopHitsAggregation : MetricAggregationBase, ITopHitsAggregation
5249
public IHighlight Highlight { get; set; }
5350
public bool? Explain { get; set; }
5451
public IScriptFields ScriptFields { get; set; }
55-
public Fields FielddataFields { get; set; }
5652
public Fields StoredFields { get; set; }
5753
public bool? Version { get; set; }
5854
public bool? TrackScores { get; set; }
@@ -83,8 +79,6 @@ public class TopHitsAggregationDescriptor<T>
8379

8480
IScriptFields ITopHitsAggregation.ScriptFields { get; set; }
8581

86-
Fields ITopHitsAggregation.FielddataFields { get; set; }
87-
8882
Fields ITopHitsAggregation.StoredFields { get; set; }
8983

9084
bool? ITopHitsAggregation.Version { get; set; }
@@ -116,9 +110,6 @@ public TopHitsAggregationDescriptor<T> Highlight(Func<HighlightDescriptor<T>, IH
116110
public TopHitsAggregationDescriptor<T> ScriptFields(Func<ScriptFieldsDescriptor, IPromise<IScriptFields>> scriptFieldsSelector) =>
117111
Assign(a => a.ScriptFields = scriptFieldsSelector?.Invoke(new ScriptFieldsDescriptor())?.Value);
118112

119-
public TopHitsAggregationDescriptor<T> FielddataFields(Func<FieldsDescriptor<T>, IPromise<Fields>> fields) =>
120-
Assign(a => a.FielddataFields = fields?.Invoke(new FieldsDescriptor<T>())?.Value);
121-
122113
public TopHitsAggregationDescriptor<T> StoredFields(Func<FieldsDescriptor<T>, IPromise<Fields>> fields) =>
123114
Assign(a => a.StoredFields = fields?.Invoke(new FieldsDescriptor<T>())?.Value);
124115

src/Nest/Search/Search/InnerHits/InnerHits.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ public interface IInnerHits
3333
[JsonProperty(PropertyName = "version")]
3434
bool? Version { get; set; }
3535

36-
[JsonProperty(PropertyName = "fielddata_fields")]
37-
IList<Field> FielddataFields { get; set; }
38-
3936
[JsonProperty(PropertyName = "script_fields")]
4037
IScriptFields ScriptFields { get; set; }
4138
}
@@ -58,8 +55,6 @@ public class InnerHits : IInnerHits
5855

5956
public bool? Version { get; set; }
6057

61-
public IList<Field> FielddataFields { get; set; }
62-
6358
public IScriptFields ScriptFields { get; set; }
6459
}
6560

@@ -74,7 +69,6 @@ public class InnerHitsDescriptor<T> : DescriptorBase<InnerHitsDescriptor<T>, IIn
7469
bool? IInnerHits.Explain { get; set; }
7570
Union<bool, ISourceFilter> IInnerHits.Source { get; set; }
7671
bool? IInnerHits.Version { get; set; }
77-
IList<Field> IInnerHits.FielddataFields { get; set; }
7872
IScriptFields IInnerHits.ScriptFields { get; set; }
7973

8074
public InnerHitsDescriptor<T> From(int? from) => Assign(a => a.From = from);
@@ -83,12 +77,6 @@ public class InnerHitsDescriptor<T> : DescriptorBase<InnerHitsDescriptor<T>, IIn
8377

8478
public InnerHitsDescriptor<T> Name(string name) => Assign(a => a.Name = name);
8579

86-
public InnerHitsDescriptor<T> FielddataFields(params Field[] fielddataFields) =>
87-
Assign(a => a.FielddataFields = fielddataFields?.ToListOrNullIfEmpty());
88-
89-
public InnerHitsDescriptor<T> FielddataFields(params Expression<Func<T, object>>[] fielddataFields) =>
90-
Assign(a => a.FielddataFields = fielddataFields?.Select(f => (Field)f).ToListOrNullIfEmpty());
91-
9280
public InnerHitsDescriptor<T> Explain(bool? explain = true) => Assign(a => a.Explain = explain);
9381

9482
public InnerHitsDescriptor<T> Version(bool? version = true) => Assign(a => a.Version = version);

src/Nest/Search/Search/SearchRequest.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ public partial interface ISearchRequest : ICovariantSearchRequest
6363
[JsonProperty("stored_fields")]
6464
Fields StoredFields { get; set; }
6565

66-
[JsonProperty("fielddata_fields")]
67-
Fields FielddataFields { get; set; }
68-
6966
[JsonProperty("script_fields")]
7067
IScriptFields ScriptFields { get; set; }
7168

@@ -113,7 +110,6 @@ public partial class SearchRequest
113110
public double? MinScore { get; set; }
114111
public long? TerminateAfter { get; set; }
115112
public Fields StoredFields { get; set; }
116-
public Fields FielddataFields { get; set; }
117113
public IScriptFields ScriptFields { get; set; }
118114
public Union<bool, ISourceFilter> Source { get; set; }
119115
public IList<ISort> Sort { get; set; }
@@ -158,7 +154,6 @@ public partial class SearchRequest<T>
158154
public double? MinScore { get; set; }
159155
public long? TerminateAfter { get; set; }
160156
public Fields StoredFields { get; set; }
161-
public Fields FielddataFields { get; set; }
162157
public IScriptFields ScriptFields { get; set; }
163158
public Union<bool, ISourceFilter> Source { get; set; }
164159
public IList<ISort> Sort { get; set; }
@@ -227,7 +222,6 @@ public partial class SearchDescriptor<T> where T : class
227222
QueryContainer ISearchRequest.Query { get; set; }
228223
QueryContainer ISearchRequest.PostFilter { get; set; }
229224
Fields ISearchRequest.StoredFields { get; set; }
230-
Fields ISearchRequest.FielddataFields { get; set; }
231225
IScriptFields ISearchRequest.ScriptFields { get; set; }
232226
Union<bool, ISourceFilter> ISearchRequest.Source { get; set; }
233227
AggregationDictionary ISearchRequest.Aggregations { get; set; }
@@ -374,12 +368,6 @@ public SearchDescriptor<T> StoredFields(Func<FieldsDescriptor<T>, IPromise<Field
374368

375369
public SearchDescriptor<T> StoredFields(Fields fields) => Assign(a => a.StoredFields = fields);
376370

377-
///<summary>
378-
///A comma-separated list of fields to return as the field data representation of a field for each hit
379-
///</summary>
380-
public SearchDescriptor<T> FielddataFields(Func<FieldsDescriptor<T>, IPromise<Fields>> fields) =>
381-
Assign(a => a.FielddataFields = fields?.Invoke(new FieldsDescriptor<T>())?.Value);
382-
383371
public SearchDescriptor<T> ScriptFields(Func<ScriptFieldsDescriptor, IPromise<IScriptFields>> selector) =>
384372
Assign(a => a.ScriptFields = selector?.Invoke(new ScriptFieldsDescriptor())?.Value);
385373

src/Tests/Aggregations/Metric/TopHits/TopHitsAggregationUsageTests.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public TopHitsAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage) : ba
4949
version = true,
5050
track_scores = true,
5151
explain = true,
52-
fielddata_fields = new [] { "state", "numberOfCommits" },
5352
stored_fields = new [] { "startedOn" },
5453
highlight = new
5554
{
@@ -96,10 +95,6 @@ public TopHitsAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage) : ba
9695
.Version()
9796
.TrackScores()
9897
.Explain()
99-
.FielddataFields(fd => fd
100-
.Field(p => p.State)
101-
.Field(p => p.NumberOfCommits)
102-
)
10398
.StoredFields(f => f
10499
.Field(p => p.StartedOn)
105100
)
@@ -139,7 +134,6 @@ public TopHitsAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage) : ba
139134
Version = true,
140135
TrackScores = true,
141136
Explain = true,
142-
FielddataFields = new [] { "state", "numberOfCommits" },
143137
StoredFields = new[] { "startedOn" },
144138
Highlight = new Highlight
145139
{
@@ -176,8 +170,6 @@ protected override void ExpectResponse(ISearchResponse<Project> response)
176170
hits.Should().NotBeNullOrEmpty();
177171
hits.All(h => h.Explanation != null).Should().BeTrue();
178172
hits.All(h => h.Version.HasValue).Should().BeTrue();
179-
hits.All(h => h.Fields.ValuesOf<StateOfBeing>("state").Any()).Should().BeTrue();
180-
hits.All(h => h.Fields.ValuesOf<int>("numberOfCommits").Any()).Should().BeTrue();
181173
hits.All(h => h.Fields.ValuesOf<int>("commit_factor").Any()).Should().BeTrue();
182174
hits.All(h => h.Fields.ValuesOf<DateTime>("startedOn").Any()).Should().BeTrue();
183175
var projects = topStateHits.Documents<Project>();

src/Tests/ClientConcepts/Troubleshooting/DeprecationLogging.doc.cs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using FluentAssertions;
1+
using System;
2+
using FluentAssertions;
23
using Tests.Framework;
34
using Tests.Framework.ManagedElasticsearch.Clusters;
45
using Tests.Framework.MockData;
@@ -20,18 +21,10 @@ public DeprecationLogging(ReadOnlyCluster cluster) : base(cluster) { }
2021

2122
[I] public void RequestWithMultipleWarning()
2223
{
23-
var response = this.Client.Search<Project>(s => s
24-
.FielddataFields(fd => fd
25-
.Field(p => p.State)
26-
.Field(p => p.NumberOfCommits)
27-
)
28-
.ScriptFields(sfs => sfs
29-
.ScriptField("commit_factor", sf => sf
30-
.Inline("doc['numberOfCommits'].value * 2")
31-
.Lang("groovy")
32-
)
33-
)
34-
);
24+
//TODO come up with a new deprecation test since fielddata is gone
25+
throw new NotImplementedException();
26+
27+
var response = this.Client.Search<Project>(s => s);
3528

3629
response.ApiCall.DeprecationWarnings.Should().NotBeNullOrEmpty();
3730

src/Tests/Search/Request/FielddataFieldsUsageTests.cs

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)