Skip to content

Commit cc89674

Browse files
committed
update ES index format
1 parent b12e940 commit cc89674

File tree

1 file changed

+258
-89
lines changed

1 file changed

+258
-89
lines changed

migrations/elasticsearch_sync.js

Lines changed: 258 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -33,97 +33,266 @@ function getRequestBody(indexName) {
3333
const projectMapping = {
3434
_all: { enabled: false },
3535
properties: {
36-
id: { type: 'long' },
37-
directProjectId: { type: 'long' },
38-
billingAccountId: { type: 'long' },
39-
name: { type: 'string' },
40-
description: { type: 'string' },
41-
external: { type: 'object',
42-
properties: {
43-
id: { type: 'string', index: 'not_analyzed' },
44-
type: { type: 'string', index: 'not_analyzed' },
45-
data: { type: 'string' },
46-
} },
47-
bookmarks: { type: 'nested',
48-
properties: {
49-
title: { type: 'string' },
50-
address: { type: 'string' },
51-
} },
52-
utm: { type: 'object',
53-
properties: {
54-
campaign: { type: 'string' },
55-
medium: { type: 'string' },
56-
source: { type: 'string' },
57-
} },
58-
estimatedPrice: { type: 'double' },
59-
actualPrice: { type: 'double' },
60-
terms: { type: 'integer' },
61-
type: { type: 'string', index: 'not_analyzed' },
62-
status: { type: 'string', index: 'not_analyzed' },
63-
details: { type: 'nested',
64-
properties: {
65-
summary: { type: 'string' },
66-
utm: { type: 'nested',
67-
properties: {
68-
code: { type: 'string' },
69-
} },
70-
TBD_usageDescription: { type: 'string' },
71-
TBD_features: { type: 'nested',
72-
properties: {
73-
id: { type: 'integer' },
74-
title: { type: 'string' },
75-
description: { type: 'string' },
76-
isCustom: { type: 'boolean' },
77-
} },
78-
} },
79-
challengeEligibility: { type: 'nested',
80-
properties: {
81-
role: { type: 'string', index: 'not_analyzed' },
82-
users: { type: 'long' },
83-
groups: { type: 'long' },
84-
} },
85-
cancelReason: { type: 'string' },
86-
createdAt: { type: 'date' },
87-
updatedAt: { type: 'date' },
88-
createdBy: { type: 'integer' },
89-
updatedBy: { type: 'integer' },
90-
// project members nested data type
91-
members: {
92-
type: 'nested',
93-
properties: {
94-
id: { type: 'long' },
95-
userId: { type: 'long' },
96-
projectId: { type: 'long' },
97-
role: { type: 'string', index: 'not_analyzed' },
98-
firstName: { type: 'string' },
99-
lastName: { type: 'string' },
100-
email: { type: 'string', index: 'not_analyzed' },
101-
handle: { type: 'string', index: 'not_analyzed' },
102-
isPrimary: { type: 'boolean' },
103-
createdAt: { type: 'date' },
104-
updatedAt: { type: 'date' },
105-
createdBy: { type: 'integer' },
106-
updatedBy: { type: 'integer' },
107-
},
36+
"actualPrice": {
37+
"type": "double"
10838
},
109-
// project attachments nested data type
110-
attachments: {
111-
type: 'nested',
112-
properties: {
113-
id: { type: 'long' },
114-
title: { type: 'string' },
115-
size: { type: 'double' },
116-
category: { type: 'string', index: 'not_analyzed' },
117-
description: { type: 'string' },
118-
filePath: { type: 'string' },
119-
projectId: { type: 'long' },
120-
contentType: { type: 'string', index: 'not_analyzed' },
121-
createdAt: { type: 'date' },
122-
updatedAt: { type: 'date' },
123-
createdBy: { type: 'integer' },
124-
updatedBy: { type: 'integer' },
125-
},
39+
"attachments": {
40+
"type": "nested",
41+
"properties": {
42+
"category": {
43+
"type": "string",
44+
"index": "not_analyzed"
45+
},
46+
"contentType": {
47+
"type": "string",
48+
"index": "not_analyzed"
49+
},
50+
"createdAt": {
51+
"type": "date",
52+
"format": "strict_date_optional_time||epoch_millis"
53+
},
54+
"createdBy": {
55+
"type": "integer"
56+
},
57+
"description": {
58+
"type": "string"
59+
},
60+
"filePath": {
61+
"type": "string"
62+
},
63+
"id": {
64+
"type": "long"
65+
},
66+
"projectId": {
67+
"type": "long"
68+
},
69+
"size": {
70+
"type": "double"
71+
},
72+
"title": {
73+
"type": "string"
74+
},
75+
"updatedAt": {
76+
"type": "date",
77+
"format": "strict_date_optional_time||epoch_millis"
78+
},
79+
"updatedBy": {
80+
"type": "integer"
81+
}
82+
}
83+
},
84+
"billingAccountId": {
85+
"type": "long"
86+
},
87+
"bookmarks": {
88+
"type": "nested",
89+
"properties": {
90+
"address": {
91+
"type": "string"
92+
},
93+
"title": {
94+
"type": "string"
95+
}
96+
}
97+
},
98+
"cancelReason": {
99+
"type": "string"
100+
},
101+
"challengeEligibility": {
102+
"type": "nested",
103+
"properties": {
104+
"groups": {
105+
"type": "long"
106+
},
107+
"role": {
108+
"type": "string",
109+
"index": "not_analyzed"
110+
},
111+
"users": {
112+
"type": "long"
113+
}
114+
}
115+
},
116+
"createdAt": {
117+
"type": "date",
118+
"format": "strict_date_optional_time||epoch_millis"
119+
},
120+
"createdBy": {
121+
"type": "integer"
122+
},
123+
"description": {
124+
"type": "string"
125+
},
126+
"details": {
127+
"type": "nested",
128+
"properties": {
129+
"TBD_features": {
130+
"type": "nested",
131+
"properties": {
132+
"description": {
133+
"type": "string"
134+
},
135+
"id": {
136+
"type": "integer"
137+
},
138+
"isCustom": {
139+
"type": "boolean"
140+
},
141+
"title": {
142+
"type": "string"
143+
}
144+
}
145+
},
146+
"TBD_usageDescription": {
147+
"type": "string"
148+
},
149+
"appDefinition": {
150+
"properties": {
151+
"goal": {
152+
"properties": {
153+
"value": {
154+
"type": "string"
155+
}
156+
}
157+
},
158+
"primaryTarget": {
159+
"type": "string"
160+
},
161+
"users": {
162+
"properties": {
163+
"value": {
164+
"type": "string"
165+
}
166+
}
167+
}
168+
}
169+
},
170+
"hideDiscussions": {
171+
"type": "boolean"
172+
},
173+
"products": {
174+
"type": "string"
175+
},
176+
"summary": {
177+
"type": "string"
178+
},
179+
"utm": {
180+
"type": "nested",
181+
"properties": {
182+
"code": {
183+
"type": "string"
184+
}
185+
}
186+
}
187+
}
188+
},
189+
"directProjectId": {
190+
"type": "long"
191+
},
192+
"estimatedPrice": {
193+
"type": "double"
194+
},
195+
"external": {
196+
"properties": {
197+
"data": {
198+
"type": "string"
199+
},
200+
"id": {
201+
"type": "string",
202+
"index": "not_analyzed"
203+
},
204+
"type": {
205+
"type": "string",
206+
"index": "not_analyzed"
207+
}
208+
}
209+
},
210+
"id": {
211+
"type": "long"
212+
},
213+
"members": {
214+
"type": "nested",
215+
"properties": {
216+
"createdAt": {
217+
"type": "date",
218+
"format": "strict_date_optional_time||epoch_millis"
219+
},
220+
"createdBy": {
221+
"type": "integer"
222+
},
223+
"email": {
224+
"type": "string",
225+
"index": "not_analyzed"
226+
},
227+
"firstName": {
228+
"type": "string"
229+
},
230+
"handle": {
231+
"type": "string",
232+
"index": "not_analyzed"
233+
},
234+
"id": {
235+
"type": "long"
236+
},
237+
"isPrimary": {
238+
"type": "boolean"
239+
},
240+
"lastName": {
241+
"type": "string"
242+
},
243+
"projectId": {
244+
"type": "long"
245+
},
246+
"role": {
247+
"type": "string",
248+
"index": "not_analyzed"
249+
},
250+
"updatedAt": {
251+
"type": "date",
252+
"format": "strict_date_optional_time||epoch_millis"
253+
},
254+
"updatedBy": {
255+
"type": "integer"
256+
},
257+
"userId": {
258+
"type": "long"
259+
}
260+
}
261+
},
262+
"name": {
263+
"type": "string"
264+
},
265+
"status": {
266+
"type": "string",
267+
"index": "not_analyzed"
268+
},
269+
"terms": {
270+
"type": "integer"
271+
},
272+
"type": {
273+
"type": "string",
274+
"index": "not_analyzed"
275+
},
276+
"updatedAt": {
277+
"type": "date",
278+
"format": "strict_date_optional_time||epoch_millis"
279+
},
280+
"updatedBy": {
281+
"type": "integer"
126282
},
283+
"utm": {
284+
"properties": {
285+
"campaign": {
286+
"type": "string"
287+
},
288+
"medium": {
289+
"type": "string"
290+
},
291+
"source": {
292+
"type": "string"
293+
}
294+
}
295+
}
127296
},
128297
};
129298
switch (indexName) {

0 commit comments

Comments
 (0)