refactor: get index from .env

This commit is contained in:
Methapon2001 2023-11-23 10:32:49 +07:00
parent dd1547d7c2
commit 1c3ac35ed1
No known key found for this signature in database
GPG key ID: 849924FEF46BD132
3 changed files with 21 additions and 21 deletions

View file

@ -11,7 +11,7 @@ export class SearchController extends Controller {
@SuccessResponse(HttpStatusCode.OK)
public async searchFile(@Body() search: Search): Promise<EhrFile[]> {
const result = await esClient.search<EhrFile & { attachment: Record<string, string> }>({
index: "ehr-api-client",
index: process.env.ELASTICSEARCH_INDEX ?? 'ehr-index',
query: {
bool: {
must: search.AND?.map((v) => ({ match: { [v.field]: v.value } })),