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.
Merge branch 'main' into http/remove-replace-buildnr-with-sha
* main: use build hash in FTR tests [Security Solution] Fix moderate typo (elastic#175883) [Fleet] Fix conflicting dynamic template mappings for intermediate objects (elastic#175970) [Visualize] Prevent overwriting managed content (elastic#175274) [SLO] Add/edit form mark optional fields (elastic#175807) skip failing test suite (elastic#175984) [data views] Provide method of excluding data tiers when getting field list (elastic#167946) [Dataset quality] State management (elastic#174906) [Cloud Security] add is_internal config option for outputs (elastic#175546)
- Loading branch information
Showing
120 changed files
with
2,190 additions
and
655 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -523,6 +523,7 @@ | |
"hosts", | ||
"is_default", | ||
"is_default_monitoring", | ||
"is_internal", | ||
"is_preconfigured", | ||
"key", | ||
"name", | ||
|
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
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
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
47 changes: 47 additions & 0 deletions
47
src/plugins/data_views/server/rest_api_routes/internal/utils.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,47 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { getIndexFilterDsl } from './utils'; | ||
|
||
describe('getIndexFilterDsl', () => { | ||
const indexFilter = { term: { _id: '1' } }; | ||
const tiersQuery = { | ||
bool: { | ||
must_not: [ | ||
{ | ||
terms: { | ||
_tier: ['data_cold', 'data_frozen'], | ||
}, | ||
}, | ||
], | ||
}, | ||
}; | ||
const excludedTiers = 'data_cold, data_frozen'; | ||
|
||
it('no indexFilter, no excluded tiers', () => { | ||
expect(getIndexFilterDsl({})).toBeUndefined(); | ||
}); | ||
|
||
it('indexFilter, no excluded tiers', () => { | ||
expect(getIndexFilterDsl({ indexFilter })).toEqual(indexFilter); | ||
}); | ||
|
||
it('excluded tiers, no indexFilter', () => { | ||
expect(getIndexFilterDsl({ excludedTiers })).toEqual(tiersQuery); | ||
}); | ||
|
||
it('indexFilter and excluded tiers', () => { | ||
const combinedQuery = { | ||
bool: { | ||
must: [indexFilter, tiersQuery], | ||
}, | ||
}; | ||
|
||
expect(getIndexFilterDsl({ indexFilter, excludedTiers })).toEqual(combinedQuery); | ||
}); | ||
}); |
46 changes: 46 additions & 0 deletions
46
src/plugins/data_views/server/rest_api_routes/internal/utils.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,46 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { QueryDslQueryContainer } from '../../../common/types'; | ||
|
||
const excludeTiersDsl = (excludedTiers: string) => { | ||
const _tier = excludedTiers.split(',').map((tier) => tier.trim()); | ||
return { | ||
bool: { | ||
must_not: [ | ||
{ | ||
terms: { | ||
_tier, | ||
}, | ||
}, | ||
], | ||
}, | ||
}; | ||
}; | ||
|
||
interface GetIndexFilterDslOptions { | ||
indexFilter?: QueryDslQueryContainer; | ||
excludedTiers?: string; | ||
} | ||
|
||
export const getIndexFilterDsl = ({ | ||
indexFilter, | ||
excludedTiers, | ||
}: GetIndexFilterDslOptions): QueryDslQueryContainer | undefined => { | ||
if (!indexFilter) { | ||
return excludedTiers ? excludeTiersDsl(excludedTiers) : undefined; | ||
} | ||
|
||
return !excludedTiers | ||
? indexFilter | ||
: { | ||
bool: { | ||
must: [indexFilter, excludeTiersDsl(excludedTiers)], | ||
}, | ||
}; | ||
}; |
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
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
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
Oops, something went wrong.