opensearch-client 0.3.1

Strongly typed OpenSearch Client
Documentation
/*
 * opensearch-client
 *
 * Rust Client for OpenSearch
 *
 * The version of the OpenAPI document: 3.1.0
 * Contact: alberto.paro@gmail.com
 * Generated by Paro OpenAPI Generator
 */

use crate::common;
use crate::indices;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, Serialize, Deserialize)]
pub struct IndexTemplateMapping {
    /// Aliases to add.
    /// If the index template includes a `data_stream` object, these are data stream aliases.
    /// Otherwise, these are index aliases.
    /// Data stream aliases ignore the `index_routing`, `routing`, and `search_routing` options.
    #[serde(rename = "aliases", default, skip_serializing_if = "Option::is_none")]
    pub aliases: Option<serde_json::Value>,
    #[serde(rename = "mappings", default, skip_serializing_if = "Option::is_none")]
    pub mappings: Option<common::mapping::TypeMapping>,
    /// The index settings to be updated.
    #[serde(rename = "settings", default, skip_serializing_if = "Option::is_none")]
    pub settings: Option<indices::IndexSettings>,
}

impl IndexTemplateMapping {
    pub fn clean_for_create(&self) -> Self {
        let mut clone = self.clone();
        if let Some(settings) = &clone.settings {
            clone.settings = Some(settings.clean_for_create());
        }
        clone
    }
}