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 serde::{Deserialize, Serialize};

/// track_total_hits
/// The number of hits matching the query. When `true`, the exact
/// number of hits is returned at the cost of some performance. When `false`, the
/// response does not include the total number of hits matching the query.
/// Default is `10,000` hits.
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagged)]
pub enum TrackTotalHits {
    EnabledValue(bool),
    CountValue(u32),
}

impl std::fmt::Display for TrackTotalHits {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            TrackTotalHits::EnabledValue(value) => write!(f, "{}", value),
            TrackTotalHits::CountValue(value) => write!(f, "{}", value),
        }
    }
}