pub struct UpdateActionBody {
pub doc: Option<Value>,
pub upsert: Option<Value>,
pub doc_as_upsert: Option<bool>,
pub script: Option<Script>,
}Fields§
§doc: Option<Value>§upsert: Option<Value>§doc_as_upsert: Option<bool>§script: Option<Script>Implementations§
Source§impl UpdateActionBody
Represents the body of an update action.
impl UpdateActionBody
Represents the body of an update action.
This struct provides methods for creating different types of update actions. An update action can be created with a document, a script, or a script with parameters.
§Examples
Creating an update action with a document:
use serde_json::json;
use opensearch_client::types::bulk::UpdateActionBody;
let doc = json!({
"name": "John Doe",
"age": 30,
});
let update_action = UpdateActionBody::new(doc);Creating an update action with a script:
use opensearch_client::types::bulk::UpdateActionBody;
let script = r#"ctx._source.age += params.age"#;
let update_action = UpdateActionBody::from_script(script);Creating an update action with a script and parameters:
use serde_json::json;
use opensearch_client::types::bulk::UpdateActionBody;
let script = r#"ctx._source.age += params.age"#;
let params = json!({
"age": 5,
});
let update_action = UpdateActionBody::from_script_parameters(script, params);Creating an update action with a pre-defined script:
use opensearch_client::types::bulk::{UpdateActionBody, Script};
let script = Script {
source: r#"ctx._source.age += params.age"#.to_string(),
params: Some(json!({
"age": 5,
})),
};
let update_action = UpdateActionBody::with_script(script);Sourcepub fn from_script(script: &str) -> Self
pub fn from_script(script: &str) -> Self
Sourcepub fn from_script_parameters(script: &str, params: Value) -> Self
pub fn from_script_parameters(script: &str, params: Value) -> Self
Sourcepub fn with_script(script: Script) -> Self
pub fn with_script(script: Script) -> Self
Trait Implementations§
Source§impl Clone for UpdateActionBody
impl Clone for UpdateActionBody
Source§fn clone(&self) -> UpdateActionBody
fn clone(&self) -> UpdateActionBody
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UpdateActionBody
impl Debug for UpdateActionBody
Source§impl Default for UpdateActionBody
impl Default for UpdateActionBody
Source§fn default() -> UpdateActionBody
fn default() -> UpdateActionBody
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for UpdateActionBody
impl<'de> Deserialize<'de> for UpdateActionBody
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for UpdateActionBody
impl PartialEq for UpdateActionBody
Source§impl Serialize for UpdateActionBody
impl Serialize for UpdateActionBody
impl StructuralPartialEq for UpdateActionBody
Auto Trait Implementations§
impl Freeze for UpdateActionBody
impl RefUnwindSafe for UpdateActionBody
impl Send for UpdateActionBody
impl Sync for UpdateActionBody
impl Unpin for UpdateActionBody
impl UnwindSafe for UpdateActionBody
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more