@@ -16,7 +16,7 @@ export const INDEX_MAPPING = {
|
||||
analysis: {
|
||||
analyzer: {
|
||||
lowercase_analyzer: {
|
||||
type: 'custom',
|
||||
type: 'custom' as const,
|
||||
tokenizer: 'keyword',
|
||||
filter: ['lowercase']
|
||||
}
|
||||
@@ -26,31 +26,31 @@ export const INDEX_MAPPING = {
|
||||
mappings: {
|
||||
properties: {
|
||||
plaintext: {
|
||||
type: 'text',
|
||||
type: 'text' as const,
|
||||
analyzer: 'lowercase_analyzer',
|
||||
fields: {
|
||||
keyword: {
|
||||
type: 'keyword'
|
||||
type: 'keyword' as const
|
||||
}
|
||||
}
|
||||
},
|
||||
md5: {
|
||||
type: 'keyword'
|
||||
type: 'keyword' as const
|
||||
},
|
||||
sha1: {
|
||||
type: 'keyword'
|
||||
type: 'keyword' as const
|
||||
},
|
||||
sha256: {
|
||||
type: 'keyword'
|
||||
type: 'keyword' as const
|
||||
},
|
||||
sha512: {
|
||||
type: 'keyword'
|
||||
type: 'keyword' as const
|
||||
},
|
||||
bcrypt: {
|
||||
type: 'keyword'
|
||||
type: 'keyword' as const
|
||||
},
|
||||
created_at: {
|
||||
type: 'date'
|
||||
type: 'date' as const
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,8 +63,9 @@ export async function initializeIndex(): Promise<void> {
|
||||
if (!indexExists) {
|
||||
await esClient.indices.create({
|
||||
index: INDEX_NAME,
|
||||
...INDEX_MAPPING
|
||||
} as any);
|
||||
settings: INDEX_MAPPING.settings,
|
||||
mappings: INDEX_MAPPING.mappings
|
||||
});
|
||||
console.log(`Index '${INDEX_NAME}' created successfully with 10 shards`);
|
||||
} else {
|
||||
console.log(`Index '${INDEX_NAME}' already exists`);
|
||||
|
||||
@@ -73,7 +73,7 @@ export function isHash(input: string): boolean {
|
||||
export async function verifyBcrypt(plaintext: string, hash: string): Promise<boolean> {
|
||||
try {
|
||||
return await bcrypt.compare(plaintext, hash);
|
||||
} catch (error) {
|
||||
} catch (_error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Referencia en una nueva incidencia
Block a user