Skip to content

Commit 4a24d73

Browse files
authored
Merge pull request #62 from eisbilir/dev
fix: resource booking search issues
2 parents ec14608 + 5da339c commit 4a24d73

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
@@ -105,7 +105,8 @@ async function createIndex () {
105105
properties: {
106106
id: { type: 'keyword' },
107107
resourceBookingId: { type: 'keyword' },
108-
userHandle: { type: 'keyword' },
108+
userHandle: { type: 'keyword',
109+
normalizer: 'lowercaseNormalizer' },
109110
projectId: { type: 'integer' },
110111
userId: { type: 'keyword' },
111112
startDate: { type: 'date', format: 'yyyy-MM-dd' },
@@ -179,7 +180,29 @@ async function createIndex () {
179180
]
180181

181182
for (const index of indices) {
182-
await esClient.indices.create(index)
183+
await esClient.indices.create({ index: index.index })
184+
await esClient.indices.close({ index: index.index })
185+
await esClient.indices.putSettings({
186+
index: index.index,
187+
body: {
188+
settings: {
189+
analysis: {
190+
normalizer: {
191+
lowercaseNormalizer: {
192+
filter: ['lowercase']
193+
}
194+
}
195+
}
196+
}
197+
}
198+
})
199+
await esClient.indices.open({ index: index.index })
200+
await esClient.indices.putMapping({
201+
index: index.index,
202+
body: {
203+
properties: index.body.mappings.properties
204+
}
205+
})
183206
logger.info({ component: 'createIndex', message: `ES Index ${index.index} creation succeeded!` })
184207
}
185208
process.exit(0)

0 commit comments

Comments
 (0)