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




#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SearchResponse {  /// The time taken to execute the search.
    #[serde(rename = "took", default, skip_serializing_if = "Option::is_none")]
    pub took: Option<u32>,
    #[serde(rename = "hits")]
    pub hits: ml::SearchHits,
    #[serde(rename = "_shards", default, skip_serializing_if = "Option::is_none")]
    pub shards: Option<common::ShardStatistics>,  /// Whether the search timed out.
    #[serde(rename = "timed_out", default, skip_serializing_if = "Option::is_none")]
    pub timed_out: Option<bool>,
}

impl SearchResponse {
    
    pub fn new(hits: ml::SearchHits) -> SearchResponse {
        SearchResponse {
            took: None,
            hits,
            shards: None,
            timed_out: None,
        }
    }
}