Skip to content

Commit 0b0543f

Browse files
jaymodealeksmaus
andauthored
Manage Fleet system indices within Elasticsearch (#70689)
This commit moves the management of seven system indices that are used by Fleet to an Elasticsearch plugin. The mappings were taken largely untouched from the Fleet server project, with the exception of adding a _meta field with a version key to enable the system indices infrastructure to manage these indices. Co-authored-by: Aleksandr Maus <[email protected]>
1 parent b24a7e2 commit 0b0543f

File tree

14 files changed

+824
-10
lines changed

14 files changed

+824
-10
lines changed

server/src/main/java/org/elasticsearch/indices/SystemIndexManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ private Version readMappingVersion(SystemIndexDescriptor descriptor, MappingMeta
278278
} catch (ElasticsearchParseException e) {
279279
logger.error(new ParameterizedMessage("Cannot parse the mapping for index [{}]", indexName), e);
280280
throw new ElasticsearchException("Cannot parse the mapping for index [{}]", e, indexName);
281+
} catch (IllegalArgumentException e) {
282+
logger.error(new ParameterizedMessage("Cannot parse the mapping for index [{}]", indexName), e);
283+
throw e;
281284
}
282285
}
283286

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ClientHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public static Map<String, String> filterSecurityHeaders(Map<String, String> head
9393
public static final String STACK_ORIGIN = "stack";
9494
public static final String SEARCHABLE_SNAPSHOTS_ORIGIN = "searchable_snapshots";
9595
public static final String LOGSTASH_MANAGEMENT_ORIGIN = "logstash_management";
96+
public static final String FLEET_ORIGIN = "fleet";
9697

9798
private ClientHelper() {}
9899

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"settings": {
3+
"auto_expand_replicas": "0-1"
4+
},
5+
"mappings": {
6+
"_doc" : {
7+
"dynamic": false,
8+
"_meta": {
9+
"version": "${fleet.version}"
10+
},
11+
"properties": {
12+
"action_id": {
13+
"type": "keyword"
14+
},
15+
"agents": {
16+
"type": "keyword"
17+
},
18+
"data": {
19+
"enabled": false,
20+
"type": "object"
21+
},
22+
"expiration": {
23+
"type": "date"
24+
},
25+
"input_type": {
26+
"type": "keyword"
27+
},
28+
"@timestamp": {
29+
"type": "date"
30+
},
31+
"type": {
32+
"type": "keyword"
33+
},
34+
"user_id" : {
35+
"type": "keyword"
36+
}
37+
}
38+
}
39+
}
40+
}
Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
{
2+
"settings": {
3+
"auto_expand_replicas": "0-1"
4+
},
5+
"mappings": {
6+
"_doc" : {
7+
"dynamic": false,
8+
"_meta": {
9+
"version": "${fleet.version}"
10+
},
11+
"properties": {
12+
"access_api_key_id": {
13+
"type": "keyword"
14+
},
15+
"action_seq_no": {
16+
"type": "integer",
17+
"index": false
18+
},
19+
"active": {
20+
"type": "boolean"
21+
},
22+
"agent": {
23+
"properties": {
24+
"id": {
25+
"type": "keyword"
26+
},
27+
"version": {
28+
"type": "keyword"
29+
}
30+
}
31+
},
32+
"default_api_key": {
33+
"type": "keyword"
34+
},
35+
"default_api_key_id": {
36+
"type": "keyword"
37+
},
38+
"enrolled_at": {
39+
"type": "date"
40+
},
41+
"last_checkin": {
42+
"type": "date"
43+
},
44+
"last_checkin_status": {
45+
"type": "keyword"
46+
},
47+
"last_updated": {
48+
"type": "date"
49+
},
50+
"local_metadata": {
51+
"properties": {
52+
"elastic": {
53+
"properties": {
54+
"agent": {
55+
"properties": {
56+
"build": {
57+
"properties": {
58+
"original": {
59+
"type": "text",
60+
"fields": {
61+
"keyword": {
62+
"type": "keyword",
63+
"ignore_above": 256
64+
}
65+
}
66+
}
67+
}
68+
},
69+
"id": {
70+
"type": "keyword"
71+
},
72+
"log_level": {
73+
"type": "keyword"
74+
},
75+
"snapshot": {
76+
"type": "boolean"
77+
},
78+
"upgradeable": {
79+
"type": "boolean"
80+
},
81+
"version": {
82+
"type": "text",
83+
"fields": {
84+
"keyword": {
85+
"type": "keyword",
86+
"ignore_above": 16
87+
}
88+
}
89+
}
90+
}
91+
}
92+
}
93+
},
94+
"host": {
95+
"properties": {
96+
"architecture": {
97+
"type": "keyword"
98+
},
99+
"hostname": {
100+
"type": "text",
101+
"fields": {
102+
"keyword": {
103+
"type": "keyword",
104+
"ignore_above": 256
105+
}
106+
}
107+
},
108+
"id": {
109+
"type": "keyword"
110+
},
111+
"ip": {
112+
"type": "text",
113+
"fields": {
114+
"keyword": {
115+
"type": "keyword",
116+
"ignore_above": 64
117+
}
118+
}
119+
},
120+
"mac": {
121+
"type": "text",
122+
"fields": {
123+
"keyword": {
124+
"type": "keyword",
125+
"ignore_above": 17
126+
}
127+
}
128+
},
129+
"name": {
130+
"type": "text",
131+
"fields": {
132+
"keyword": {
133+
"type": "keyword",
134+
"ignore_above": 256
135+
}
136+
}
137+
}
138+
}
139+
},
140+
"os": {
141+
"properties": {
142+
"family": {
143+
"type": "keyword"
144+
},
145+
"full": {
146+
"type": "text",
147+
"fields": {
148+
"keyword": {
149+
"type": "keyword",
150+
"ignore_above": 128
151+
}
152+
}
153+
},
154+
"kernel": {
155+
"type": "text",
156+
"fields": {
157+
"keyword": {
158+
"type": "keyword",
159+
"ignore_above": 128
160+
}
161+
}
162+
},
163+
"name": {
164+
"type": "text",
165+
"fields": {
166+
"keyword": {
167+
"type": "keyword",
168+
"ignore_above": 256
169+
}
170+
}
171+
},
172+
"platform": {
173+
"type": "keyword"
174+
},
175+
"version": {
176+
"type": "text",
177+
"fields": {
178+
"keyword": {
179+
"type": "keyword",
180+
"ignore_above": 32
181+
}
182+
}
183+
}
184+
}
185+
}
186+
}
187+
},
188+
"packages": {
189+
"type": "keyword"
190+
},
191+
"policy_coordinator_idx": {
192+
"type": "integer"
193+
},
194+
"policy_id": {
195+
"type": "keyword"
196+
},
197+
"policy_output_permissions_hash": {
198+
"type": "keyword"
199+
},
200+
"policy_revision_idx": {
201+
"type": "integer"
202+
},
203+
"shared_id": {
204+
"type": "keyword"
205+
},
206+
"type": {
207+
"type": "keyword"
208+
},
209+
"unenrolled_at": {
210+
"type": "date"
211+
},
212+
"unenrollment_started_at": {
213+
"type": "date"
214+
},
215+
"updated_at": {
216+
"type": "date"
217+
},
218+
"upgrade_started_at": {
219+
"type": "date"
220+
},
221+
"upgraded_at": {
222+
"type": "date"
223+
},
224+
"user_provided_metadata": {
225+
"type": "object",
226+
"enabled": false
227+
}
228+
}
229+
}
230+
}
231+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"settings": {
3+
"auto_expand_replicas": "0-1"
4+
},
5+
"mappings": {
6+
"_doc" : {
7+
"dynamic": false,
8+
"_meta": {
9+
"version": "${fleet.version}"
10+
},
11+
"properties": {
12+
"identifier": {
13+
"type": "keyword"
14+
},
15+
"compression_algorithm": {
16+
"type": "keyword",
17+
"index": false
18+
},
19+
"encryption_algorithm": {
20+
"type": "keyword",
21+
"index": false
22+
},
23+
"encoded_sha256": {
24+
"type": "keyword"
25+
},
26+
"encoded_size": {
27+
"type": "long",
28+
"index": false
29+
},
30+
"decoded_sha256": {
31+
"type": "keyword"
32+
},
33+
"decoded_size": {
34+
"type": "long",
35+
"index": false
36+
},
37+
"created": {
38+
"type": "date"
39+
},
40+
"package_name": {
41+
"type": "keyword"
42+
},
43+
"type": {
44+
"type": "keyword"
45+
},
46+
"relative_url": {
47+
"type": "keyword"
48+
},
49+
"body": {
50+
"type": "binary"
51+
}
52+
}
53+
}
54+
}
55+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"settings": {
3+
"auto_expand_replicas": "0-1"
4+
},
5+
"mappings": {
6+
"_doc" : {
7+
"dynamic": false,
8+
"_meta": {
9+
"version": "${fleet.version}"
10+
},
11+
"properties": {
12+
"active": {
13+
"type": "boolean"
14+
},
15+
"api_key": {
16+
"type": "keyword"
17+
},
18+
"api_key_id": {
19+
"type": "keyword"
20+
},
21+
"created_at": {
22+
"type": "date"
23+
},
24+
"expire_at": {
25+
"type": "date"
26+
},
27+
"name": {
28+
"type": "keyword"
29+
},
30+
"policy_id": {
31+
"type": "keyword"
32+
},
33+
"updated_at": {
34+
"type": "date"
35+
}
36+
}
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)