1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use crate::{ElasticMapping, JobsLog};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, Default, JsonSchema)]
#[serde(rename_all = "camelCase")]
pub struct RecordMeta {
pub(crate) guid: String,
#[serde(rename = "type")]
pub(crate) typ: String,
pub(crate) id: String,
#[serde(default)]
pub(crate) jobs: JobsLog,
}
impl RecordMeta {
pub fn jobs(&self) -> &JobsLog {
&self.jobs
}
pub fn jobs_mut(&mut self) -> &mut JobsLog {
&mut self.jobs
}
}
impl ElasticMapping for RecordMeta {
fn elastic_mapping() -> serde_json::Value {
serde_json::json!({
"guid": {
"type": "keyword"
},
"id": {
"type": "keyword"
},
"typ": {
"type": "keyword"
},
})
}
}