diff --git a/src/endpoints/statistics/index.ts b/src/endpoints/statistics/index.ts index 96e558e..f171d9e 100644 --- a/src/endpoints/statistics/index.ts +++ b/src/endpoints/statistics/index.ts @@ -3,7 +3,7 @@ import filesize from 'filesize'; import EsInstance from '../../ElasticSearchClientInstance'; import { esBiospecimenIndex, esFileIndex, esParticipantIndex, esStudyIndex, esVariantIndex } from '../../esUtils'; -import { biospecimenIdKey, familyIdKey, fileIdKey, participantIdKey, studyIdKey } from '../../fieldsKeys'; +import { biospecimenIdKey, familyCountKey, fileIdKey, participantIdKey, studyIdKey } from '../../fieldsKeys'; import { isInclude } from '../../projectUtils'; export type Diagnosis = { @@ -74,9 +74,9 @@ const fetchParticipantStats = async (client: Client): Promise => { const fetchFamilyStats = async (client: Client): Promise => { const { body } = await client.search({ - index: esParticipantIndex, + index: esStudyIndex, body: { - aggs: { types_count: { value_count: { field: familyIdKey } } }, + aggs: { types_count: { value_count: { field: familyCountKey } } }, }, size: 0, }); diff --git a/src/fieldsKeys.ts b/src/fieldsKeys.ts index d3d63e8..3835628 100644 --- a/src/fieldsKeys.ts +++ b/src/fieldsKeys.ts @@ -3,7 +3,7 @@ export const fileIdKey = 'file_id'; export const studyIdKey = 'study_id'; export const participantIdKey = 'participant_id'; export const biospecimenIdKey = 'sample_id'; -export const familyIdKey = 'family.family_id'; +export const familyCountKey = 'family_count'; export const participantKey = 'fhir_id'; export const participantFileKey = 'files.fhir_id'; export const participantBiospecimenKey = 'files.biospecimens.fhir_id';