Skip to main content

opensearch_client/indices/
put_mapping.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 serde::{Deserialize, Serialize};
13
14/// PutMapping
15/// The mapping definition
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
18pub struct PutMapping {
19    /// Mapping for a field. For new fields, this mapping can include:
20    ///
21    /// - Field name
22    /// - Field data type
23    /// - Mapping parameters
24    #[serde(
25        rename = "properties",
26        default,
27        skip_serializing_if = "Option::is_none"
28    )]
29    pub properties: Option<serde_json::Value>,
30    #[serde(
31        rename = "_field_names",
32        default,
33        skip_serializing_if = "Option::is_none"
34    )]
35    pub field_names: Option<common::mapping::FieldNamesField>,
36    #[serde(rename = "_source", default, skip_serializing_if = "Option::is_none")]
37    pub source: Option<common::mapping::SourceField>,
38    /// If date detection is enabled then new string fields are checked
39    /// against `dynamic_date_formats` and if the value matches then
40    /// a new date field is added instead of string.
41    #[serde(
42        rename = "dynamic_date_formats",
43        default,
44        skip_serializing_if = "Option::is_none"
45    )]
46    pub dynamic_date_formats: Option<Vec<String>>,
47    /// Controls whether dynamic date detection is enabled.
48    #[serde(
49        rename = "date_detection",
50        default,
51        skip_serializing_if = "Option::is_none"
52    )]
53    pub date_detection: Option<bool>,
54    #[serde(rename = "_routing", default, skip_serializing_if = "Option::is_none")]
55    pub routing: Option<common::mapping::RoutingField>,
56    #[serde(rename = "_meta", default, skip_serializing_if = "Option::is_none")]
57    pub meta: Option<common::Metadata>,
58    #[serde(rename = "dynamic", default, skip_serializing_if = "Option::is_none")]
59    pub dynamic: Option<String>,
60    /// Automatically map strings into numeric data types for all fields.
61    #[serde(
62        rename = "numeric_detection",
63        default,
64        skip_serializing_if = "Option::is_none"
65    )]
66    pub numeric_detection: Option<bool>,
67}
68
69impl PutMapping {
70    /// The mapping definition
71    pub fn new() -> PutMapping {
72        PutMapping {
73            properties: None,
74            field_names: None,
75            source: None,
76            dynamic_date_formats: None,
77            date_detection: None,
78            routing: None,
79            meta: None,
80            dynamic: None,
81            numeric_detection: None,
82        }
83    }
84}