Skip to main content

opensearch_client/common/
source.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/// _source
15
16/// Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered.
17/// Use this setting with the `source_includes` and `source_excludes` parameters.
18#[derive(Clone, Debug, Serialize, Deserialize)]
19pub enum Source {
20    Fields(common::Fields),
21    FetchValue(bool),
22}
23
24impl std::fmt::Display for Source {
25    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
26        match self {
27            Self::Fields(v) => write!(f, "{}", v),
28            Self::FetchValue(v) => write!(f, "{}", *v),
29        }
30    }
31}
32
33impl Default for Source {
34    fn default() -> Source {
35        Self::FetchValue(true)
36    }
37}