@@ -18,6 +18,13 @@ public partial interface IUpdateRequest<TDocument, TPartialDocument>
1818 [ JsonProperty ( PropertyName = "doc_as_upsert" ) ]
1919 bool ? DocAsUpsert { get ; set ; }
2020
21+ /// <summary>
22+ /// If you would like your script to run regardless of whether the document exists or not — i.e. the script handles
23+ /// initializing the document instead of the upsert element — then set scripted_upsert to true
24+ /// </summary>
25+ [ JsonProperty ( PropertyName = "scripted_upsert" ) ]
26+ bool ? ScriptedUpsert { get ; set ; }
27+
2128 [ JsonProperty ( PropertyName = "doc" ) ]
2229 TPartialDocument Doc { get ; set ; }
2330
@@ -29,12 +36,20 @@ public partial class UpdateRequest<TDocument, TPartialDocument>
2936 where TDocument : class
3037 where TPartialDocument : class
3138 {
39+ /// <inheritdoc/>
3240 public IScript Script { get ; set ; }
41+ /// <inheritdoc/>
3342 public TDocument Upsert { get ; set ; }
43+ /// <inheritdoc/>
3444 public bool ? DocAsUpsert { get ; set ; }
45+ /// <inheritdoc/>
3546 public TPartialDocument Doc { get ; set ; }
47+ /// <inheritdoc/>
3648 public bool ? DetectNoop { get ; set ; }
49+ /// <inheritdoc/>
50+ public bool ? ScriptedUpsert { get ; set ; }
3751
52+ /// <inheritdoc/>
3853 public Fields Fields
3954 {
4055 get { return Self . RequestParameters . GetQueryStringValue < Fields > ( "fields" ) ; }
@@ -56,6 +71,8 @@ public partial class UpdateDescriptor<TDocument, TPartialDocument>
5671
5772 bool ? IUpdateRequest < TDocument , TPartialDocument > . DetectNoop { get ; set ; }
5873
74+ bool ? IUpdateRequest < TDocument , TPartialDocument > . ScriptedUpsert { get ; set ; }
75+
5976 /// <summary>
6077 /// The full document to be created if an existing document does not exist for a partial merge.
6178 /// </summary>
@@ -70,6 +87,8 @@ public partial class UpdateDescriptor<TDocument, TPartialDocument>
7087
7188 public UpdateDescriptor < TDocument , TPartialDocument > DetectNoop ( bool detectNoop = true ) => Assign ( a => a . DetectNoop = detectNoop ) ;
7289
90+ public UpdateDescriptor < TDocument , TPartialDocument > ScriptedUpsert ( bool scriptedUpsert = true ) => Assign ( a => a . ScriptedUpsert = scriptedUpsert ) ;
91+
7392 public UpdateDescriptor < TDocument , TPartialDocument > Script ( Func < ScriptDescriptor , IScript > scriptSelector ) =>
7493 Assign ( a => a . Script = scriptSelector ? . Invoke ( new ScriptDescriptor ( ) ) ) ;
7594
0 commit comments