fix(core): update

This commit is contained in:
2023-08-29 11:11:25 +02:00
parent cdbf1fd316
commit 203444d1a6
8 changed files with 1805 additions and 538 deletions

View File

@@ -1,7 +1,7 @@
import * as plugins from './els.plugins.js';
import { ElsSmartlogDestination } from './els.classes.smartlogdestination.js';
import { type ILogPackage } from '@pushrocks/smartlog-interfaces';
import { Stringmap } from '@pushrocks/lik';
import { type ILogPackage } from '@push.rocks/smartlog-interfaces';
import { Stringmap } from '@push.rocks/lik';
export class ElasticIndex {
private stringmap = new Stringmap();
@@ -18,7 +18,7 @@ export class ElasticIndex {
const responseArg = await this.elasticSearchRef.client.cat.indices({
format: 'json',
bytes: 'm',
bytes: 'mb',
}).catch(err => {
console.log(err);
});
@@ -27,8 +27,8 @@ export class ElasticIndex {
throw new Error('Could not get valid response from elastic search');
}
if (Array.isArray(responseArg.body)) {
const filteredIndices = responseArg.body.filter((indexObjectArg) => {
if (Array.isArray(responseArg)) {
const filteredIndices = responseArg.filter((indexObjectArg) => {
return indexObjectArg.index.startsWith(prefixArg);
});
const filteredIndexNames = filteredIndices.map((indexObjectArg) => {
@@ -39,8 +39,8 @@ export class ElasticIndex {
let index = null;
if (Array.isArray(responseArg.body)) {
index = responseArg.body.find((indexItemArg) => {
if (Array.isArray(responseArg)) {
index = responseArg.find((indexItemArg) => {
return indexItemArg.index === indexNameArg;
});
}
@@ -55,7 +55,7 @@ export class ElasticIndex {
public async createNewIndex(indexNameArg: string) {
const response = await this.elasticSearchRef.client.indices.create({
wait_for_active_shards: '1',
wait_for_active_shards: 1,
index: indexNameArg,
body: {
mappings: {