forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[eem] narrow down index patterns in definition templates (elastic#189182
) In elastic#188410 we moved history and latest index templates from global scope to definition scope. The definition-scoped templates have a wide pattern that would grep any other definition template already installed and throw the following error because of conflicting priority. This change narrows down the index patterns defined in the templates to only grep the ones from the installed definition ``` { "statusCode": 500, "error": "Internal Server Error", "message": """[illegal_argument_exception Root causes: illegal_argument_exception: index template [entities_v1_history_admin-console-services_index_template] has index patterns [.entities.v1.history.*] matching patterns from existing templates [entities_v1_history_builtin_services_from_ecs_data_index_template] with patterns (entities_v1_history_builtin_services_from_ecs_data_index_template => [.entities.v1.history.*]) that have the same priority [200], multiple index templates may not match during index creation, please use a different priority]: index template [entities_v1_history_admin-console-services_index_template] has index patterns [.entities.v1.history.*] matching patterns from existing templates [entities_v1_history_builtin_services_from_ecs_data_index_template] with patterns (entities_v1_history_builtin_services_from_ecs_data_index_template => [.entities.v1.history.*]) that have the same priority [200], multiple index templates may not match during index creation, please use a different priority""" } ``` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
61ad27e
commit 10bfb4b
Showing
18 changed files
with
307 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...ugins/observability_solution/entity_manager/server/lib/entities/helpers/fixtures/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export { entityDefinition } from './entity_definition'; | ||
export { entityDefinitionWithBackfill } from './entity_definition_with_backfill'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
...anager/server/lib/entities/templates/__snapshots__/entities_history_template.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
78 changes: 78 additions & 0 deletions
78
...manager/server/lib/entities/templates/__snapshots__/entities_latest_template.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
...y_solution/entity_manager/server/lib/entities/templates/entities_history_template.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { entityDefinition } from '../helpers/fixtures/entity_definition'; | ||
import { getEntitiesHistoryIndexTemplateConfig } from './entities_history_template'; | ||
|
||
describe('getEntitiesHistoryIndexTemplateConfig(definitionId)', () => { | ||
it('should generate a valid index template', () => { | ||
const template = getEntitiesHistoryIndexTemplateConfig(entityDefinition.id); | ||
expect(template).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...ty_solution/entity_manager/server/lib/entities/templates/entities_latest_template.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { entityDefinition } from '../helpers/fixtures/entity_definition'; | ||
import { getEntitiesLatestIndexTemplateConfig } from './entities_latest_template'; | ||
|
||
describe('getEntitiesLatestIndexTemplateConfig(definitionId)', () => { | ||
it('should generate a valid index template', () => { | ||
const template = getEntitiesLatestIndexTemplateConfig(entityDefinition.id); | ||
expect(template).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...nager/server/lib/entities/transform/__snapshots__/generate_history_transform.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
x-pack/test/api_integration/apis/entity_manager/definitions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
import { EntityDefinition } from '@kbn/entities-schema'; | ||
import { | ||
entityDefinition as mockDefinition, | ||
entityDefinitionWithBackfill as mockBackfillDefinition, | ||
} from '@kbn/entityManager-plugin/server/lib/entities/helpers/fixtures'; | ||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
import { installDefinition, uninstallDefinition, getInstalledDefinitions } from './helpers/request'; | ||
|
||
export default function ({ getService }: FtrProviderContext) { | ||
const supertest = getService('supertest'); | ||
|
||
describe('Entity definitions', () => { | ||
describe('definitions installations', () => { | ||
it('can install multiple definitions', async () => { | ||
await installDefinition(supertest, mockDefinition); | ||
await installDefinition(supertest, mockBackfillDefinition); | ||
|
||
const { definitions } = await getInstalledDefinitions(supertest); | ||
expect(definitions.length).to.eql(2); | ||
expect( | ||
definitions.find((definition: EntityDefinition) => definition.id === mockDefinition.id) | ||
); | ||
expect( | ||
definitions.find( | ||
(definition: EntityDefinition) => definition.id === mockBackfillDefinition.id | ||
) | ||
); | ||
|
||
await uninstallDefinition(supertest, mockDefinition.id); | ||
await uninstallDefinition(supertest, mockBackfillDefinition.id); | ||
}); | ||
}); | ||
}); | ||
} |
Oops, something went wrong.