elasticsearch_dsl/search/response/
total_hits.rs

1use super::TotalHitsRelation;
2
3/// Total number of matched documents
4#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)]
5pub struct TotalHits {
6    /// Number of total documents
7    pub value: u64,
8
9    /// Relation to total number of matched documents
10    pub relation: TotalHitsRelation,
11}
12
13impl TotalHits {
14    /// Create default Total instance
15    pub fn new(value: Option<u64>) -> Self {
16        Self {
17            value: value.unwrap_or(0),
18            relation: TotalHitsRelation::Equal,
19        }
20    }
21}