tools: elasticsearch prepare analyzer

This commit is contained in:
Methapon2001 2023-12-01 14:30:47 +07:00
parent ef961feddd
commit 8452d959c9
No known key found for this signature in database
GPG key ID: 849924FEF46BD132

View file

@ -27,21 +27,49 @@ esClient.ingest.putPipeline({
},
});
esClient.indices.putMapping({
esClient.indices.create({
index: DEFAULT_INDEX,
body: {
settings: {
index: {
analysis: {
analyzer: {
analyzer_shingle: {
type: "custom",
tokenizer: "icu_tokenizer",
filter: ["filter_shingle"],
},
},
filter: {
filter_shingle: {
type: "shingle",
max_shingle_size: 3,
min_shingle_size: 2,
output_unigrams: true,
},
},
},
},
},
mappings: {
properties: {
pathname: {
type: "keyword",
},
path: {
type: "keyword",
},
path: { type: "keyword" },
pathname: { type: "keyword" },
fileName: { type: "text", analyzer: "analyzer_shingle" },
title: { type: "text", analyzer: "analyzer_shingle" },
description: { type: "text", analyzer: "analyzer_shingle" },
"attachment.content": { type: "text", analyzer: "analyzer_shingle" },
},
},
});
minioClient.makeBucket(DEFAULT_BUCKET!, (e) => {
if (!e) console.log("Success. Configuration is needed for Bucket Notification to AMQP.");
console.error(e);
if (!e) {
console.log("Success.");
console.log("Configuration is required for Bucket Notification to AMQP.");
console.log("Configuration is required for Keycloak.");
} else {
console.error(e);
}
});