Skip to content

Commit 106ce73

Browse files
Mpdreamzrusscam
authored andcommitted
remove script file related API's and obsoleted Indexed on descriptors in favor of Id
1 parent fd9fd8d commit 106ce73

File tree

16 files changed

+21
-166
lines changed

16 files changed

+21
-166
lines changed

src/Nest/Aggregations/Metric/Percentiles/PercentilesAggregationJsonConverter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ protected void ReadMetricProperties(IMetricAggregation metric, Dictionary<string
4242
var scriptProps = JObject.FromObject(properties["script"]).Properties().ToDictionary(p => p.Name, p => p.Value);
4343
if (scriptProps.ContainsKey("source") || scriptProps.ContainsKey("inline"))
4444
metric.Script = properties["script"].ToObject<InlineScript>();
45-
else if (scriptProps.ContainsKey("file"))
46-
metric.Script = properties["script"].ToObject<FileScript>();
4745
else if (scriptProps.ContainsKey("id"))
4846
metric.Script = properties["id"].ToObject<IndexedScript>();
4947
}

src/Nest/CommonOptions/Scripting/FileScript.cs

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

src/Nest/CommonOptions/Scripting/ScriptBase.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ public TDescriptor Params(Func<FluentDictionary<string, object>, FluentDictionar
4242

4343
public class ScriptDescriptor : DescriptorBase<ScriptDescriptor, IDescriptor>
4444
{
45-
public FileScriptDescriptor File(string file) => new FileScriptDescriptor(file);
45+
public IndexedScriptDescriptor Id(string id) => new IndexedScriptDescriptor(id);
4646

47+
[Obsolete("Indexed() sets a property named id, this is confusing and thats why we intent to remove this in NEST 7.x please use Id()")]
4748
public IndexedScriptDescriptor Indexed(string id) => new IndexedScriptDescriptor(id);
4849

4950
[Obsolete("Inline is being deprecated for Source and will be removed in Elasticsearch 7.0")]

src/Nest/CommonOptions/Scripting/ScriptJsonConverter.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
2929
var inline = dict["source"].ToString();
3030
script = new InlineScript(inline);
3131
}
32-
if (dict.ContainsKey("file"))
33-
{
34-
var file = dict["file"].ToString();
35-
script = new FileScript(file);
36-
}
3732
if (dict.ContainsKey("id"))
3833
{
3934
var id = dict["id"].ToString();

src/Nest/Ingest/Processors/ScriptProcessor.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ public interface IScriptProcessor : IProcessor
2020
[JsonProperty("lang")]
2121
string Lang { get; set; }
2222

23-
/// <summary>
24-
/// The script file to refer to
25-
/// </summary>
26-
[JsonProperty("file")]
27-
string File { get; set; }
28-
2923
/// <summary>
3024
/// The stored script id to refer to
3125
/// </summary>
@@ -62,11 +56,6 @@ public class ScriptProcessor : ProcessorBase, IScriptProcessor
6256
/// </summary>
6357
public string Lang { get; set; }
6458

65-
/// <summary>
66-
/// The script file to refer to
67-
/// </summary>
68-
public string File { get; set; }
69-
7059
/// <summary>
7160
/// The stored script id to refer to
7261
/// </summary>
@@ -93,7 +82,6 @@ public class ScriptProcessorDescriptor
9382
protected override string Name => "script";
9483

9584
string IScriptProcessor.Lang { get; set; }
96-
string IScriptProcessor.File{ get; set; }
9785
string IScriptProcessor.Id{ get; set; }
9886
string IScriptProcessor.Inline { get => Self.Source; set => Self.Source = value; }
9987
string IScriptProcessor.Source { get; set; }
@@ -104,11 +92,6 @@ public class ScriptProcessorDescriptor
10492
/// </summary>
10593
public ScriptProcessorDescriptor Lang(string lang) => Assign(a => a.Lang = lang);
10694

107-
/// <summary>
108-
/// The script file to refer to
109-
/// </summary>
110-
public ScriptProcessorDescriptor File(string file) => Assign(a => a.File = file);
111-
11295
/// <summary>
11396
/// The stored script id to refer to
11497
/// </summary>

src/Nest/QueryDsl/Specialized/Script/ScriptQuery.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ public interface IScriptQuery : IQuery
2020
[JsonProperty("id")]
2121
Id Id { get; set; }
2222

23-
[JsonProperty("file")]
24-
string File { get; set; }
25-
2623
[JsonProperty("params")]
2724
[JsonConverter(typeof(VerbatimDictionaryKeysJsonConverter<string, object>))]
2825
Dictionary<string, object> Params { get; set; }
@@ -38,13 +35,12 @@ public class ScriptQuery : QueryBase, IScriptQuery
3835
[Obsolete("Inline is being deprecated for Source and will be removed in Elasticsearch 7.0")]
3936
public string Inline { get => this.Source; set => this.Source = value; }
4037
public Id Id { get; set; }
41-
public string File { get; set; }
4238
public Dictionary<string, object> Params { get; set; }
4339
public string Lang { get; set; }
4440

4541
internal override void InternalWrapInContainer(IQueryContainer c) => c.Script = this;
4642
internal static bool IsConditionless(IScriptQuery q) =>
47-
q.Source.IsNullOrEmpty() && q.Id == null && q.File.IsNullOrEmpty();
43+
q.Source.IsNullOrEmpty() && q.Id == null;
4844

4945
}
5046

@@ -56,7 +52,6 @@ public class ScriptQueryDescriptor<T>
5652
string IScriptQuery.Inline { get => Self.Source; set => Self.Source = value; }
5753
string IScriptQuery.Source { get; set; }
5854
Id IScriptQuery.Id { get; set; }
59-
string IScriptQuery.File { get; set; }
6055
string IScriptQuery.Lang { get; set; }
6156
Dictionary<string, object> IScriptQuery.Params { get; set; }
6257

@@ -70,11 +65,6 @@ public class ScriptQueryDescriptor<T>
7065
/// <summary> Id of an indexed script to execute </summary>
7166
public ScriptQueryDescriptor<T> Id(string scriptId) => Assign(a => a.Id = scriptId);
7267

73-
/// <summary>
74-
/// File name of a script to execute
75-
/// </summary>
76-
public ScriptQueryDescriptor<T> File(string scriptFile) => Assign(a => a.File = scriptFile);
77-
7868
/// <summary>
7969
/// Scripts are compiled and cached for faster execution.
8070
/// If the same script can be used, just with different parameters provided,

src/Nest/QueryDsl/Specialized/Script/ScriptQueryConverter.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
2424
writer.WriteStartObject();
2525
{
2626
if (v.Id != null) writer.WriteProperty(serializer, "id", v.Id);
27-
if (v.File != null) writer.WriteProperty(serializer, "file", v.File);
2827
if (v.Source != null) writer.WriteProperty(serializer, "source", v.Source);
2928
if (v.Lang != null) writer.WriteProperty(serializer, "lang", v.Lang);
3029
if (v.Params != null) writer.WriteProperty(serializer, "params", v.Params);
@@ -55,9 +54,6 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
5554
case "id":
5655
r.Id = p.Value.Value<string>();
5756
break;
58-
case "file":
59-
r.File = p.Value.Value<string>();
60-
break;
6157
case "inline":
6258
case "source":
6359
r.Source = p.Value.Value<string>();

src/Nest/XPack/Watcher/Condition/FileScriptCondition.cs

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

src/Nest/XPack/Watcher/Condition/ScriptConditionBase.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,14 @@ public abstract class ScriptConditionBase : ConditionBase, IScriptCondition
2727

2828
public class ScriptConditionDescriptor : DescriptorBase<ScriptConditionDescriptor, IDescriptor>
2929
{
30-
public FileScriptConditionDescriptor File(string file) => new FileScriptConditionDescriptor(file);
31-
30+
public IndexedScriptConditionDescriptor Id(string id) => new IndexedScriptConditionDescriptor(id);
31+
[Obsolete("Indexed() sets a property named id, this is confusing and thats why we intent to remove this in NEST 7.x please use Id()")]
3232
public IndexedScriptConditionDescriptor Indexed(string id) => new IndexedScriptConditionDescriptor(id);
3333

34+
[Obsolete("Inline is being deprecated for Source and will be removed in Elasticsearch 7.0")]
3435
public InlineScriptConditionDescriptor Inline(string script) => new InlineScriptConditionDescriptor(script);
36+
37+
public InlineScriptConditionDescriptor Source(string source) => new InlineScriptConditionDescriptor(source);
3538
}
3639

3740
public abstract class ScriptConditionDescriptorBase<TDescriptor, TInterface>
@@ -77,11 +80,6 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
7780
var inline = dict["source"].ToString();
7881
scriptCondition = new InlineScriptCondition(inline);
7982
}
80-
if (dict.ContainsKey("file"))
81-
{
82-
var file = dict["file"].ToString();
83-
scriptCondition = new FileScriptCondition(file);
84-
}
8583
if (dict.ContainsKey("id"))
8684
{
8785
var id = dict["id"].ToString();

src/Nest/XPack/Watcher/Transform/FileScriptTransform.cs

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

0 commit comments

Comments
 (0)