More app directory refactoring
This commit is contained in:
parent
b312a8c862
commit
8bbeaa25cf
55 changed files with 903 additions and 899 deletions
|
|
@ -8,10 +8,16 @@ const globalIndex = ".kibana_1";
|
|||
const dataIndexName = "sample_tagged_tickets";
|
||||
const userMetadataIndexName = "user_metadata";
|
||||
|
||||
const baseURL = `https://${process.env.OPENSEARCH_USERNAME}:${process.env.OPENSEARCH_PASSWORD}@${process.env.OPENSEARCH_URL}`;
|
||||
// const baseURL = `https://${process.env.OPENSEARCH_USERNAME}:${process.env.OPENSEARCH_PASSWORD}@${process.env.OPENSEARCH_URL}`;
|
||||
|
||||
const baseURL = `https://localhost:9200`;
|
||||
|
||||
const createClient = () => new Client({
|
||||
node: baseURL,
|
||||
auth: {
|
||||
username: process.env.OPENSEARCH_USERNAME!,
|
||||
password: process.env.OPENSEARCH_PASSWORD!,
|
||||
},
|
||||
ssl: {
|
||||
rejectUnauthorized: false,
|
||||
},
|
||||
|
|
@ -532,6 +538,7 @@ export const getTrends = async (limit: number) => {
|
|||
|
||||
export const getTemplates = async (limit: number) => {
|
||||
const client = createClient();
|
||||
|
||||
const query = {
|
||||
query: {
|
||||
bool: {
|
||||
|
|
@ -546,11 +553,14 @@ export const getTemplates = async (limit: number) => {
|
|||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
const rawResponse = await client.search({
|
||||
index: globalIndex,
|
||||
size: limit,
|
||||
body: query,
|
||||
});
|
||||
|
||||
const response = rawResponse.body;
|
||||
const {
|
||||
hits: { hits },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue