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
16
17
18#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
19pub struct DocumentSimulation {
20    #[serde(rename = "_index")]
21    pub index: String,  /// Certain APIs may return values, including numbers such as epoch timestamps, as strings. This setting captures
22  /// this behavior while keeping the semantics of the field type.
23  /// 
24  /// Depending on the target language, code generators can keep the union or remove it and leniently parse
25  /// strings to the target type.
26    #[serde(rename = "_version", default, skip_serializing_if = "Option::is_none")]
27    pub version: Option<common::StringifiedVersionNumber>,  /// Value used to send the document to a specific primary shard.
28    #[serde(rename = "_routing", default, skip_serializing_if = "Option::is_none")]
29    pub routing: Option<String>,
30    #[serde(rename = "_version_type", default, skip_serializing_if = "Option::is_none")]
31    pub version_type: Option<String>,
32    #[serde(rename = "_ingest")]
33    pub ingest: ingest::simulate::Ingest,
34    #[serde(rename = "_id")]
35    pub id: String,  /// JSON body for the document.
36    #[serde(rename = "_source")]
37    pub source: serde_json::Value,
38}
39
40impl DocumentSimulation {
41    
42    pub fn new(index: String, ingest: ingest::simulate::Ingest, id: String, source: serde_json::Value) -> DocumentSimulation {
43        DocumentSimulation {
44            index,
45            version: None,
46            routing: None,
47            version_type: None,
48            ingest,
49            id,
50            source,
51        }
52    }
53}