Skip to content

Commit 4b20e8e

Browse files
committed
fix: resource booking search issues
1 parent 1836259 commit 4b20e8e

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

src/scripts/createIndex.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ async function createIndex () {
104104
properties: {
105105
id: { type: 'keyword' },
106106
resourceBookingId: { type: 'keyword' },
107-
userHandle: { type: 'keyword' },
107+
userHandle: { type: 'keyword',
108+
normalizer: 'lowercaseNormalizer' },
108109
projectId: { type: 'integer' },
109110
userId: { type: 'keyword' },
110111
startDate: { type: 'date', format: 'yyyy-MM-dd' },
@@ -145,7 +146,29 @@ async function createIndex () {
145146
]
146147

147148
for (const index of indices) {
148-
await esClient.indices.create(index)
149+
await esClient.indices.create({ index: index.index })
150+
await esClient.indices.close({ index: index.index })
151+
await esClient.indices.putSettings({
152+
index: index.index,
153+
body: {
154+
settings: {
155+
analysis: {
156+
normalizer: {
157+
lowercaseNormalizer: {
158+
filter: ['lowercase']
159+
}
160+
}
161+
}
162+
}
163+
}
164+
})
165+
await esClient.indices.open({ index: index.index })
166+
await esClient.indices.putMapping({
167+
index: index.index,
168+
body: {
169+
properties: index.body.mappings.properties
170+
}
171+
})
149172
logger.info({ component: 'createIndex', message: `ES Index ${index.index} creation succeeded!` })
150173
}
151174
process.exit(0)

0 commit comments

Comments
 (0)