Browse Source

add elastic env

main
matthew 2 years ago
parent
commit
172aa5ff41
  1. 6
      searching-front/services/modules/elastic/index.ts

6
searching-front/services/modules/elastic/index.ts

@ -44,7 +44,7 @@ class Elastic {
private client: Client private client: Client
constructor() { constructor() {
this.client = new Client({ this.client = new Client({
node: "http://elasticsearch:9200", node: process.env.ELASTIC_URL || "http://localhost:9200",
}) })
} }
@ -91,8 +91,8 @@ class Elastic {
public initElastic = async () => { public initElastic = async () => {
;[Languages.EN, Languages.RU].forEach(async (lang) => { ;[Languages.EN, Languages.RU].forEach(async (lang) => {
const indexName = getIndexNameByLang(lang) const indexName = getIndexNameByLang(lang)
const alreadyExist = await this.client.indices.exists({index:indexName}) const alreadyExist = await this.client.indices.exists({ index: indexName })
if(!alreadyExist){ if (!alreadyExist) {
await this.createIndex(lang) await this.createIndex(lang)
} }
}) })

Loading…
Cancel
Save