mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
# Backport This will backport the following commits from `main` to `8.6`: - [[data views] allow cross cluster index pattern negation (#147968)](https://github.com/elastic/kibana/pull/147968) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Matthew Kime","email":"matt@mattki.me"},"sourceCommit":{"committedDate":"2022-12-29T15:51:20Z","message":"[data views] allow cross cluster index pattern negation (#147968)\n\n## Summary\r\n\r\nThe data views api examines comma delimited sections to see if there are\r\nmatching indices before fetching the field list. The existing code\r\nchecked for index pattern negation - patterns that started with a `-`.\r\nHowever, it didn't check for this in cross cluster case -\r\n`this_cluster:-kibana*`. The code now handles the cross cluster case\r\nappropriately.\r\n\r\nStill, its unclear to me whether this logic is necessary, hence why I\r\nopened https://github.com/elastic/kibana/pull/147970 - I was able to\r\nresolve the failed tests most familiar to me but I will need to work\r\nwith engineers from other teams to investigate other failures.\r\n\r\nCloses https://github.com/elastic/kibana/issues/147926","sha":"e3cac218f011b3de0b39700feed1500f6129fd99","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Feature:Data Views","Team:DataDiscovery","backport:prev-minor","v8.7.0"],"number":147968,"url":"https://github.com/elastic/kibana/pull/147968","mergeCommit":{"message":"[data views] allow cross cluster index pattern negation (#147968)\n\n## Summary\r\n\r\nThe data views api examines comma delimited sections to see if there are\r\nmatching indices before fetching the field list. The existing code\r\nchecked for index pattern negation - patterns that started with a `-`.\r\nHowever, it didn't check for this in cross cluster case -\r\n`this_cluster:-kibana*`. The code now handles the cross cluster case\r\nappropriately.\r\n\r\nStill, its unclear to me whether this logic is necessary, hence why I\r\nopened https://github.com/elastic/kibana/pull/147970 - I was able to\r\nresolve the failed tests most familiar to me but I will need to work\r\nwith engineers from other teams to investigate other failures.\r\n\r\nCloses https://github.com/elastic/kibana/issues/147926","sha":"e3cac218f011b3de0b39700feed1500f6129fd99"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/147968","number":147968,"mergeCommit":{"message":"[data views] allow cross cluster index pattern negation (#147968)\n\n## Summary\r\n\r\nThe data views api examines comma delimited sections to see if there are\r\nmatching indices before fetching the field list. The existing code\r\nchecked for index pattern negation - patterns that started with a `-`.\r\nHowever, it didn't check for this in cross cluster case -\r\n`this_cluster:-kibana*`. The code now handles the cross cluster case\r\nappropriately.\r\n\r\nStill, its unclear to me whether this logic is necessary, hence why I\r\nopened https://github.com/elastic/kibana/pull/147970 - I was able to\r\nresolve the failed tests most familiar to me but I will need to work\r\nwith engineers from other teams to investigate other failures.\r\n\r\nCloses https://github.com/elastic/kibana/issues/147926","sha":"e3cac218f011b3de0b39700feed1500f6129fd99"}}]}] BACKPORT--> Co-authored-by: Matthew Kime <matt@mattki.me>
This commit is contained in:
parent
03032f86d3
commit
c735e9fc6f
2 changed files with 3 additions and 3 deletions
|
@ -40,8 +40,8 @@ describe('Index Pattern Fetcher - server', () => {
|
|||
.mockResponseOnce(emptyResponse as unknown as estypes.FieldCapsResponse)
|
||||
.mockResponse(response as unknown as estypes.FieldCapsResponse);
|
||||
// first field caps request returns empty
|
||||
const result = await indexPatterns.validatePatternListActive(['-a', 'b', 'c']);
|
||||
expect(result).toEqual(['-a', 'c']);
|
||||
const result = await indexPatterns.validatePatternListActive(['-a', 'b', 'c', 'a:-b']);
|
||||
expect(result).toEqual(['-a', 'c', 'a:-b']);
|
||||
});
|
||||
it('Returns all patterns when all match indices', async () => {
|
||||
esClient.fieldCaps.mockResponse(response as unknown as estypes.FieldCapsResponse);
|
||||
|
|
|
@ -123,7 +123,7 @@ export class IndexPatternsFetcher {
|
|||
patternList
|
||||
.map(async (index) => {
|
||||
// perserve negated patterns
|
||||
if (index.startsWith('-')) {
|
||||
if (index.startsWith('-') || index.includes(':-')) {
|
||||
return true;
|
||||
}
|
||||
const searchResponse = await this.elasticsearchClient.fieldCaps({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue