Add updated Leafcutter app

This commit is contained in:
Darren Clarke 2023-03-31 08:34:35 +02:00
parent 60f6061d49
commit 38343f4219
10 changed files with 3391 additions and 20 deletions

View file

@ -119,12 +119,22 @@ export const saveUserMetadata = async (username: string, metadata: any) => {
const getCurrentUserIndex = async (email: string) => {
const userIndexName = email.replace(/[\W\d_]/g, "").toLowerCase();
const client = createClient();
const aliasesResponse = await client.indices.getAlias({
name: `.kibana_*_${userIndexName}`,
});
// prefer alias if it exists
if (Object.keys(aliasesResponse.body).length > 0) {
return Object.keys(aliasesResponse.body)[0];
}
const indicesResponse = await client.indices.get({
index: `.kibana_*_${userIndexName}_1`,
})
const currentUserIndex = Object.keys(indicesResponse.body)[0];
return currentUserIndex;
};
}
const getIndexPattern = async (index: string) => {
const client = createClient();