[data views] Allow selection of timestamp when some index pattern segments are unmet (#189336)

Currently, if you attempt to create a data view with a index pattern
where some of the segments aren't matched, you can't select a timestamp
field. This is a common use case for security and observability. This PR
allows a timestamp selection as expected.

Closes https://github.com/elastic/kibana/issues/189024
This commit is contained in:
Matthew Kime 2024-08-01 05:04:41 -05:00 committed by GitHub
parent 3f7d1f226f
commit afa4313289
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 3 deletions

View file

@ -350,6 +350,7 @@ export class DataViewEditorService {
const getFieldsOptions: GetFieldsOptions = {
pattern: this.indexPattern,
allowHidden: this.allowHidden,
allowNoIndex: true,
};
if (this.type === INDEX_PATTERN_TYPE.ROLLUP) {
getFieldsOptions.type = INDEX_PATTERN_TYPE.ROLLUP;

View file

@ -93,9 +93,7 @@ export class IndexPatternsFetcher {
fieldTypes,
includeEmptyFields,
} = options;
const allowNoIndices = fieldCapsOptions
? fieldCapsOptions.allow_no_indices
: this.allowNoIndices;
const allowNoIndices = fieldCapsOptions?.allow_no_indices || this.allowNoIndices;
const expandWildcards = allowHidden ? 'all' : 'open';

View file

@ -147,10 +147,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
return Promise.all(comparedHeaders);
});
});
it('should support unmatched index pattern segments', async function () {
await PageObjects.settings.createIndexPattern('l*,z*', '@timestamp');
const patternName = await PageObjects.settings.getIndexPageHeading();
expect(patternName).to.be('l*,z*');
await PageObjects.settings.removeIndexPattern();
});
});
describe('edit index pattern', () => {
it('on edit click', async () => {
await testSubjects.click('detail-link-logstash-*');
await PageObjects.settings.editIndexPattern('logstash-*', '@timestamp', 'Logstash Star');
await retry.try(async () => {