mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-11 12:17:44 +02:00
UBER-1178: rework indexing fields (#4261)
Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me> Signed-off-by: Andrey Sobolev <haiodo@gmail.com> Co-authored-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
co-authored by
Andrey Sobolev
parent
66368621a0
commit
689e2d4caa
@@ -71,7 +71,20 @@ class ElasticAdapter implements FullTextAdapter {
|
||||
if (field !== undefined) {
|
||||
console.log('Mapping', mappings.body)
|
||||
}
|
||||
const wsMappings = mappings.body[toWorkspaceString(this.workspaceId)]
|
||||
let wsMappings = mappings.body[toWorkspaceString(this.workspaceId)]
|
||||
if (Object.keys(wsMappings?.mappings?.properties ?? {}).some((k) => k.includes('->'))) {
|
||||
await this.client.indices.delete({
|
||||
index: toWorkspaceString(this.workspaceId)
|
||||
})
|
||||
const createIndex = await this.client.indices.create({
|
||||
index: toWorkspaceString(this.workspaceId)
|
||||
})
|
||||
console.log('recreate index', createIndex)
|
||||
const mappings = await this.client.indices.getMapping({
|
||||
index: toWorkspaceString(this.workspaceId)
|
||||
})
|
||||
wsMappings = mappings.body[toWorkspaceString(this.workspaceId)]
|
||||
}
|
||||
|
||||
// Collect old values.
|
||||
for (const [k, v] of Object.entries(wsMappings?.mappings?.properties ?? {})) {
|
||||
|
||||
Reference in New Issue
Block a user