diff --git a/x-pack/packages/kbn-entities-schema/src/schema/entity.ts b/x-pack/packages/kbn-entities-schema/src/schema/entity.ts index 738453a7ddc7b..5df10e11bb7ed 100644 --- a/x-pack/packages/kbn-entities-schema/src/schema/entity.ts +++ b/x-pack/packages/kbn-entities-schema/src/schema/entity.ts @@ -23,7 +23,7 @@ export interface MetadataRecord { [key: string]: string[] | MetadataRecord | string; } -export interface Entity { +export interface EntityV2 { 'entity.id': string; 'entity.last_seen_timestamp': string; 'entity.type': string; diff --git a/x-pack/plugins/entity_manager/server/lib/entity_client.ts b/x-pack/plugins/entity_manager/server/lib/entity_client.ts index 0d0b141e6dc08..7045bee1fc538 100644 --- a/x-pack/plugins/entity_manager/server/lib/entity_client.ts +++ b/x-pack/plugins/entity_manager/server/lib/entity_client.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Entity, EntityDefinition, EntityDefinitionUpdate } from '@kbn/entities-schema'; +import { EntityV2, EntityDefinition, EntityDefinitionUpdate } from '@kbn/entities-schema'; import { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server'; import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; import { Logger } from '@kbn/logging'; @@ -266,7 +266,10 @@ export class EntityClient { }); this.options.logger.debug(`Entity query: ${query}`); - const rawEntities = await runESQLQuery({ query, esClient: this.options.esClient }); + const rawEntities = await runESQLQuery({ + query, + esClient: this.options.esClient, + }); return rawEntities.map((entity) => { entity['entity.id'] = source.identity_fields.map((field) => entity[field]).join(':'); diff --git a/x-pack/plugins/entity_manager/server/lib/queries/utils.ts b/x-pack/plugins/entity_manager/server/lib/queries/utils.ts index 1956daccaa07c..68f5b0f11aff2 100644 --- a/x-pack/plugins/entity_manager/server/lib/queries/utils.ts +++ b/x-pack/plugins/entity_manager/server/lib/queries/utils.ts @@ -6,12 +6,12 @@ */ import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; -import { Entity } from '@kbn/entities-schema'; +import { EntityV2 } from '@kbn/entities-schema'; import { ESQLSearchResponse } from '@kbn/es-types'; import { uniq } from 'lodash'; -function mergeEntities(entity1: Entity, entity2: Entity): Entity { - const merged: Entity = { +function mergeEntities(entity1: EntityV2, entity2: EntityV2): EntityV2 { + const merged: EntityV2 = { ...entity1, 'entity.last_seen_timestamp': new Date( Math.max( @@ -36,8 +36,8 @@ function mergeEntities(entity1: Entity, entity2: Entity): Entity { return merged; } -export function mergeEntitiesList(entities: Entity[]): Entity[] { - const instances: { [key: string]: Entity } = {}; +export function mergeEntitiesList(entities: EntityV2[]): EntityV2[] { + const instances: { [key: string]: EntityV2 } = {}; for (let i = 0; i < entities.length; i++) { const entity = entities[i]; diff --git a/x-pack/plugins/observability_solution/entity_manager_app/public/pages/overview/index.tsx b/x-pack/plugins/observability_solution/entity_manager_app/public/pages/overview/index.tsx index d04f581a8d98b..8c978db6f6751 100644 --- a/x-pack/plugins/observability_solution/entity_manager_app/public/pages/overview/index.tsx +++ b/x-pack/plugins/observability_solution/entity_manager_app/public/pages/overview/index.tsx @@ -21,7 +21,7 @@ import { EuiSpacer, EuiTitle, } from '@elastic/eui'; -import { Entity } from '@kbn/entities-schema'; +import { EntityV2 } from '@kbn/entities-schema'; import { usePluginContext } from '../../hooks/use_plugin_context'; function EntitySourceForm({ @@ -137,7 +137,7 @@ const newEntitySource = ({ export function EntityManagerOverviewPage() { const { ObservabilityPageTemplate, entityClient } = usePluginContext(); - const [previewEntities, setPreviewEntities] = useState([]); + const [previewEntities, setPreviewEntities] = useState([]); const [isSearchingEntities, setIsSearchingEntities] = useState(false); const [previewError, setPreviewError] = useState(null); const [formErrors, setFormErrors] = useState([]);