Skip to content

Commit

Permalink
Improve get entity index function
Browse files Browse the repository at this point in the history
  • Loading branch information
machadoum committed Sep 17, 2024
1 parent a8b96d8 commit c2b1724
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
*/

import type { SavedObjectsFindResponse } from '@kbn/core-saved-objects-api-server';
import { ENTITY_LATEST_PREFIX_V1 } from '@kbn/entityManager-plugin/common/constants_entities';

import {
ENTITY_LATEST,
ENTITY_SCHEMA_VERSION_V1,
entitiesIndexPattern,
} from '@kbn/entities-schema';
import type {
EngineDescriptor,
EntityType,
Expand Down Expand Up @@ -34,6 +39,10 @@ export const getByEntityTypeQuery = (entityType: EntityType) => {
};

export const getEntitiesIndexName = (entityType: EntityType) =>
`${ENTITY_LATEST_PREFIX_V1}.${getEntityDefinitionId(entityType)}`;
entitiesIndexPattern({
schemaVersion: ENTITY_SCHEMA_VERSION_V1,
dataset: ENTITY_LATEST,
definitionId: getEntityDefinitionId(entityType),
});

export const getEntityDefinitionId = (entityType: EntityType) => `ea_${entityType}_entity_store`;

0 comments on commit c2b1724

Please sign in to comment.