Skip to main content

opensearch_client/ingest/simulate/
document_simulation.rs

1/*
2 * opensearch-client
3 *
4 * Rust Client for OpenSearch
5 *
6 * The version of the OpenAPI document: 3.1.0
7 * Contact: alberto.paro@gmail.com
8 * Generated by Paro OpenAPI Generator
9 */
10
11use crate::common;
12use crate::ingest;
13use serde::{Deserialize, Serialize};
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct DocumentSimulation {
17    #[serde(rename = "_index")]
18    pub index: String,
19    /// Certain APIs may return values, including numbers such as epoch timestamps, as strings. This setting captures
20    /// this behavior while keeping the semantics of the field type.
21    ///
22    /// Depending on the target language, code generators can keep the union or remove it and leniently parse
23    /// strings to the target type.
24    #[serde(rename = "_version", default, skip_serializing_if = "Option::is_none")]
25    pub version: Option<common::StringifiedVersionNumber>,
26    /// Value used to send the document to a specific primary shard.
27    #[serde(rename = "_routing", default, skip_serializing_if = "Option::is_none")]
28    pub routing: Option<String>,
29    #[serde(
30        rename = "_version_type",
31        default,
32        skip_serializing_if = "Option::is_none"
33    )]
34    pub version_type: Option<String>,
35    #[serde(rename = "_ingest")]
36    pub ingest: ingest::simulate::Ingest,
37    #[serde(rename = "_id")]
38    pub id: String,
39    /// JSON body for the document.
40    #[serde(rename = "_source")]
41    pub source: serde_json::Value,
42}
43
44impl DocumentSimulation {
45    pub fn new(
46        index: String,
47        ingest: ingest::simulate::Ingest,
48        id: String,
49        source: serde_json::Value,
50    ) -> DocumentSimulation {
51        DocumentSimulation {
52            index,
53            version: None,
54            routing: None,
55            version_type: None,
56            ingest,
57            id,
58            source,
59        }
60    }
61}