Skip to content

Commit 0db92a2

Browse files
committed
Fix #1463: ScriptFile and ScriptId not serialized
1 parent ad4704b commit 0db92a2

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

src/Nest/DSL/Bulk/BulkUpdateDescriptor.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ public override object GetBody()
7979
{
8080
_PartialUpdate = this.Doc,
8181
_Script = this.Script,
82+
_ScriptId = this.ScriptId,
83+
_ScriptFile = this.ScriptFile,
8284
_Lang = this.Lang,
8385
_Params = this.Params,
8486
_Upsert = this.Upsert,
@@ -130,6 +132,8 @@ protected override object GetBulkOperationBody()
130132
{
131133
_PartialUpdate = Self.Doc,
132134
_Script = Self.Script,
135+
_ScriptId = Self.ScriptId,
136+
_ScriptFile = Self.ScriptFile,
133137
_Lang = Self.Lang,
134138
_Params = Self.Params,
135139
_Upsert = Self.Upsert,

src/Nest/Domain/Bulk/BulkUpdateBody.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ internal class BulkUpdateBody<TDocument, TPartialUpdate>
1818

1919
[JsonProperty(PropertyName = "script")]
2020
internal string _Script { get; set; }
21+
22+
[JsonProperty(PropertyName = "script_id")]
23+
internal string _ScriptId { get; set; }
24+
25+
[JsonProperty(PropertyName = "script_file")]
26+
internal string _ScriptFile { get; set; }
2127

2228
[JsonProperty(PropertyName = "params")]
2329
[JsonConverter(typeof(DictionaryKeysAreNotPropertyNamesJsonConverter))]

src/Tests/Nest.Tests.Unit/Core/Bulk/BulkOperations.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
{"id":3,"loc":0,"startedOn":"0001-01-01T00:00:00","longValue":0,"floatValue":0.0,"doubleValue":0.0,"boolValue":false,"locScriptField":0,"stupidIntIWantAsLong":0}
55
{ "delete" : {"_index":"nest_test_data","_type":"elasticsearchprojects","_id":"4","_version_type": "external_gte"} }
66
{ "update" : {"_index":"nest_test_data","_type":"elasticsearchprojects","_id":"3","_version_type": "external"} }
7-
{ "doc" : { "name" : "NEST" } }
7+
{ "doc" : { "name" : "NEST" }, "script_file": "myfile", "script_id": "myscript", "lang": "groovy" }

src/Tests/Nest.Tests.Unit/Core/Bulk/BulkTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public void BulkOperations()
2828
.IdFrom(new ElasticsearchProject { Id = 3 })
2929
.VersionType(VersionType.External)
3030
.Doc(new { name = "NEST"})
31+
.ScriptFile("myfile")
32+
.ScriptId("myscript")
33+
.Lang("groovy")
3134
)
3235
);
3336
var status = result.ConnectionStatus;

0 commit comments

Comments
 (0)