os_query_builder_rs/term/
exists.rs1use serde::Serialize;
2
3#[derive(Debug, Default, Clone, Serialize)]
4pub struct Exists {
5 field: String,
6 #[serde(skip_serializing_if = "Option::is_none")]
7 boost: Option<f64>,
8}
9
10impl Exists {
11 pub fn new() -> Self {
12 Self::default()
13 }
14 pub fn field<T: Into<String> + Serialize>(self, field: T) -> Self {
15 Self {
16 field: field.into(),
17 ..self
18 }
19 }
20
21 pub fn boost<T: Into<f64> + Serialize>(self, boost: T) -> Self {
22 Self {
23 boost: Some(boost.into()),
24 ..self
25 }
26 }
27}