Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
f9d8efb
update queries to use metricset.name and fix paths
neptunian Feb 10, 2022
49f8b2e
[Security Solution] Addition advanced policy options for 8.1 (#125230)
kevinlog Feb 10, 2022
e63eeb6
uptime - adjust synthetics service sync errors behavior (#125169)
dominiqueclarke Feb 10, 2022
7a1bf74
Bump backport 7.0.1 (#125252)
sorenlouv Feb 10, 2022
a13dafc
[DOCS] Updates the Upgrade docs (#125288)
gchaps Feb 10, 2022
643e439
[kbn-pm] Add trailing newline in package.json (#125320)
Feb 11, 2022
dec594b
retry test (#125284)
flash1293 Feb 11, 2022
dd0749a
[RAC][LOGS] Add reason message as a rule variable. (#124978)
fkanout Feb 11, 2022
63dffb1
[Observability overview] Fix overview page duplicate requests (#125204)
shahzad31 Feb 11, 2022
0766f18
[Uptime] Convert ui monitor management combobox to checkboxes (#124917)
dominiqueclarke Feb 11, 2022
453e22e
[Uptime] Fix flaky monitor details tests (#124700)
emilioalvap Feb 11, 2022
9ac1916
[Screenshotting] Add custom context support in the screenshot mode (#…
dokmic Feb 11, 2022
1dc175f
Fix index pattern reference in tooltip (#125220)
jsanz Feb 11, 2022
30ed7bb
[Response Ops][Cases] Fetch alerts within observability (#123883)
jonathan-buttner Feb 11, 2022
74327c7
[Uptime] Added confirm modal (#125221)
shahzad31 Feb 11, 2022
eb7591b
[Cases] Deprecate endpoints (#124773)
cnasikas Feb 11, 2022
0aba871
[Lens] Fixed the order behavior of the visualization dimensions. (#12…
Kuznietsov Feb 11, 2022
8baf9b8
Add auto scale functionality to metric unified renderer (#124811)
VladLasitsa Feb 11, 2022
3c47a05
improve variable name in test (#124849)
vadimkibana Feb 11, 2022
9cba32e
[Upgrade Assistant] Update logic for handling reindex failures (#125…
alisonelizabeth Feb 11, 2022
f7f0e70
[Upgrade Assistant] Add warning when remote clusters are configured (…
alisonelizabeth Feb 11, 2022
13d566c
[Uptime Monitor management] Update test configs (#125358)
shahzad31 Feb 11, 2022
a81b11e
[Fleet] Tell users when assets are installed in a different space (#1…
hop-dev Feb 11, 2022
2d93bcb
fixed bug where fleet server instructions were incorrectly shown (#12…
juliaElastic Feb 11, 2022
efa89e6
[Lens] Version-aware sorting to data table (#125361)
flash1293 Feb 11, 2022
2f008c5
[Fleet] Make package policy name unique when copied multiple time (#1…
nchaulet Feb 11, 2022
b0e534b
[Security Solution] Data view override for sourcerer (#125116)
stephmilovic Feb 11, 2022
2c4e476
[Lens] Fix focus on submitting filter popover (#125247)
flash1293 Feb 11, 2022
0f57c23
Scalability testing: Run Kibana with APM enabled (#125372)
dmlemeshko Feb 11, 2022
4027f91
Adds API tests for APM agent keys (#125302)
gbamparop Feb 11, 2022
9d810e0
Bootstrap user page (#124701)
machadoum Feb 11, 2022
1095208
[Reporting/Docs] Add clarity to reporting concepts (#125175)
tsullivan Feb 11, 2022
d583a5c
[Reporting] Additional CSV job output metrics (#124600)
tsullivan Feb 11, 2022
97bd50d
[Response Ops][Cases] Add more granular checks before decoding user a…
jonathan-buttner Feb 11, 2022
f1fcbe7
[Uptime] Monitor Details - fallback to saved objects when monitor det…
dominiqueclarke Feb 11, 2022
67fb388
[ML] Fix Trained Model stats and pipelines tab (#125382)
darnautov Feb 11, 2022
4fe96b7
[Security Solution] Use search strategy error in timeline (#125178)
stephmilovic Feb 11, 2022
5629dec
Add origin conflict checks when resolving import errors (#125241)
jportner Feb 11, 2022
ae51f81
[Security solution][Detections] Fixes multiple Bulk Edit issues/sugge…
vitaliidm Feb 11, 2022
7db7b1a
update docs (#125419)
mattkime Feb 11, 2022
45c41e0
fix ccr query
neptunian Feb 11, 2022
6d88579
Reduces timeouts from 10 minutes per test down to 2 minutes and chang…
FrankHassanabad Feb 11, 2022
4eb8ab8
chore(NA): upgrade bazel into v5 (#125332)
mistic Feb 11, 2022
ddbb060
Fix Controls storybook config (#125305)
Feb 11, 2022
d06dc14
fix data view runtime fields api service key (#125430)
mattkime Feb 11, 2022
17a997c
[Dashboard] Transfer state when drilldown is opened in a new tab (#12…
Heenawter Feb 11, 2022
abb05d9
fix cluster health query paths
neptunian Feb 11, 2022
cc94ec7
update elasticsearch version mismatch
neptunian Feb 11, 2022
57de770
update fetchLicense paths
neptunian Feb 11, 2022
93aa4f4
[Security Solution] add feature usage notifications (#124766)
joeypoon Feb 11, 2022
172bf98
chore(NA): upgrades rules nodejs to v4.0.0 (#125163)
mistic Feb 12, 2022
6627bd8
Elasticsearch client: no longer default to using `meta: true` (#124488)
pgayvallet Feb 12, 2022
259d1b7
[Osquery] Add telemetry for packs and saved queries (#122501)
patrykkopycinski Feb 14, 2022
db7ad4e
[Lens] small visual flyouts adjustments (#124970)
mbondyra Feb 14, 2022
7c475d8
[TSVB] Fix number fields which show NaN on invalid values (#124508)
VladLasitsa Feb 14, 2022
759f87b
[DOCS] Formats and fine-tunes ES query rule type docs (#125104)
szabosteve Feb 14, 2022
8f4de1b
Make embeddable example plugin not fail for read-only user (#125459)
vadimkibana Feb 14, 2022
eb34596
[ML] Fix auto-refresh interval (#124851)
darnautov Feb 14, 2022
a3e045b
updated fleet dependencies in readme (#125477)
juliaElastic Feb 14, 2022
d2a5c3d
Add stories for agent keys (#125407)
gbamparop Feb 14, 2022
617a602
fix formatting logic for terms (#125408)
flash1293 Feb 14, 2022
5babc9f
[TSVB] Use panel interval for annotations (#125222)
flash1293 Feb 14, 2022
c52ffd8
Update dependency elastic-apm-node to ^3.29.0 (#125453)
renovate[bot] Feb 14, 2022
c14173c
[Snapshot & Restore] Fix date parsing in the search bar (#125234)
yuliacech Feb 14, 2022
b3a7bf2
Fixes rules bulk edit tagd helper text (#125482)
vitaliidm Feb 14, 2022
9278294
[Fleet] Use registry version check on main (#125495)
joshdover Feb 14, 2022
ae31eb8
[Fleet] Trim whitespace from package policy names (#125400)
hop-dev Feb 14, 2022
4c31b15
[APM] Migrate service overview api test to apmApiClient (#125404)
kpatticha Feb 14, 2022
54de36f
[PieVis] PartitionVis integration to Lens. (#123937)
Kuznietsov Feb 14, 2022
09ff04d
skip flaky suite (#123372)
mistic Feb 14, 2022
d383bda
[Fleet] Fix invalid permission entry if the elastic agent package is …
nchaulet Feb 14, 2022
435b772
[ci] Splits Jest integration tests (#125454)
Feb 14, 2022
cc74733
fixing issue with expressions pending (#125520)
ppisljar Feb 14, 2022
91314e0
[ML] Docs screenshots - fix weblogs anomaly explorer screenshot (#125…
pheyos Feb 14, 2022
b51c87f
[ML] Fix flaky Trained Models tests (#125484)
darnautov Feb 14, 2022
b4855ba
[Fleet] refresh policies on create and flyout open (#125499)
juliaElastic Feb 14, 2022
1f4a7d4
[Osquery] Fix infinite loop (#124332)
tomsonpl Feb 14, 2022
d364f23
[TSVB][Lens] Navigate to Lens with your current configuration (#114794)
stratoula Feb 14, 2022
52e9c51
[Uptime] handle null duration on ping list (#125438)
dominiqueclarke Feb 14, 2022
93cb99d
[DOCS] Minor tweaks to upgrade docs (#125538)
gchaps Feb 14, 2022
3b833f3
[DOCS] Updates Upgrade Assistant API status (#125410)
KOTungseth Feb 14, 2022
e1ad246
[babel] Bump babel packages (#125446)
brianseeders Feb 14, 2022
31c4438
[ci] Retry failed steps in on-merge pipeline (#125550)
brianseeders Feb 14, 2022
9afca73
synthetics e2e - use custom location when defined (#125560)
dominiqueclarke Feb 14, 2022
1751cb2
Update osquery.asciidoc to address doc issue (#125425)
melissaburpo Feb 14, 2022
57aefd0
[Fleet] Add retries when starting docker registry in integration test…
nchaulet Feb 14, 2022
f4713f5
[ML] Use Discover locator in Data Visualizer instead of URL Generator…
vadimkibana Feb 14, 2022
48e8a84
[ci-stats] add Client class for accessing test group stats (#125164)
Feb 14, 2022
ff5a4dc
SavedObjects management: change index patterns labels to data views (…
pgayvallet Feb 15, 2022
f5041b4
[Logs UI] Support switching between log source modes (#124929)
miltonhultgren Feb 15, 2022
75ac8e5
[Console] Support suggesting index templates v2 (#124655)
mibragimov Feb 15, 2022
7c2437f
[Uptime monitor management] Make index template installation retry (#…
shahzad31 Feb 15, 2022
d720235
[SecuritySolution] Enrich threshold data from correct fields (#125376)
janmonschke Feb 15, 2022
0202164
[APM] Lint rule for explicit return types (#124771)
dgieselaar Feb 15, 2022
556b629
[Reporting] Add additional PNG and PDF metrics (#125450)
dokmic Feb 15, 2022
57ef9e5
[Graph] Make graph edges easier to click (#124053)
dej611 Feb 15, 2022
0e87ffc
Service overview e2e test (#125359)
MiriamAparicio Feb 15, 2022
f8df852
Update dependency broadcast-channel to ^4.10.0 (#124740)
renovate[bot] Feb 15, 2022
8facea9
[Lens] Do not allow rarity in some cases (#125523)
flash1293 Feb 15, 2022
743733d
[Fleet] Update copy for integration server (#125592)
nchaulet Feb 15, 2022
7934cd5
[Fleet] Do not mutate package policy update object (#125622)
hop-dev Feb 15, 2022
724e3b2
Reverse parent child context relationship (#125486)
Feb 15, 2022
8780230
[Fleet] extracted hook, clean up unused prop (#125610)
juliaElastic Feb 15, 2022
472fe62
skip flaky suite (#123253)
mistic Feb 15, 2022
928638e
[Fleet] Avoid breaking setup when compatible package is not available…
joshdover Feb 15, 2022
21cef49
[kibana_react] Enable Storybook for all of kibana_react (#125589)
clintandrewhall Feb 15, 2022
c2a0103
[Task Manager] Adding list of explicitly de-registered task types (#1…
ymao1 Feb 15, 2022
dde4d6e
[Uptime][Monitor Management] Use push flyout to show Test Run Result…
awahab07 Feb 15, 2022
35f4ba5
revert package policy validation that caused issue with input groups …
juliaElastic Feb 15, 2022
181d04c
[Fleet] Fix output form validation for trusted fingerprint (#125662)
nchaulet Feb 15, 2022
ea059d4
Use Discover locator to generate URL (#124282)
vadimkibana Feb 15, 2022
d4524fe
[DOCS] Removes technical preview flag from DFA ML page. (#125497)
szabosteve Feb 15, 2022
4ee8a02
Remove meta field before create/update event filter item (#125624)
dasansol92 Feb 15, 2022
8fabaf3
[SecuritySolution][Threat Hunting] Fix a couple of field ids for high…
janmonschke Feb 15, 2022
8b2a18c
[APM] Bug: Service maps popover detail metrics are aggregates over al…
cauemarcondes Feb 15, 2022
48ce5d1
[Lens][Example] Testing playground for Lens embeddables (#125061)
dej611 Feb 15, 2022
1fe2110
[SecuritySolution][Endpoint] Add a user with kibana_system and superu…
ashokaditya Feb 15, 2022
a7743b3
[APM] Reduce maxNumServices from 500 to 50 (#125646)
kpatticha Feb 15, 2022
52e94c4
use ecs properties in fetch_index_shard_size
klacabane Feb 15, 2022
07e6457
[Security Solution][Timeline] Use first event in threshold set for 'f…
madirey Feb 15, 2022
7d186f9
[Security Solution] Upgrade tests for DE rule types - alerts on legac…
madirey Feb 15, 2022
f0e5e2d
use locator in osquery plugin (#125698)
vadimkibana Feb 15, 2022
292c25d
[cft] Generate update plan based on current configuration (#125317)
jbudz Feb 15, 2022
16f3eb3
[ci] Verify docker contexts (#122897)
jbudz Feb 15, 2022
7c850dd
[Security Solutions] Updates usage collector telemetry to use PIT (Po…
FrankHassanabad Feb 15, 2022
c961b4b
[ML] Data Frame Analytics saved search creation functional tests (#12…
alvarezmelissa87 Feb 15, 2022
eafa4d9
[ML] Data Frame Analytics audit messages api test (#125325)
alvarezmelissa87 Feb 15, 2022
c6b356c
[Security Solution] unskip tests (#125675)
joeypoon Feb 15, 2022
d946361
fix: add rule type to global fields for the alert flyout (#125676)
janmonschke Feb 15, 2022
7b4c34e
Revert "[build] Include x-pack example plugins when using example-plu…
jbudz Feb 15, 2022
b11a829
[App Search] New flyout to start a crawl with custom settings (#124999)
Feb 15, 2022
81c5fbf
[Security Solutions] Exposes the search_after and point in time (pit)…
FrankHassanabad Feb 15, 2022
cf102be
#121908 - [Maps] Use UI counters to instrument when a geo field is vi…
maksimkovalev Feb 15, 2022
c4c4eee
Adds nav link to uisettings tutorial (#125736)
TinaHeiligers Feb 16, 2022
e9d82d1
Updates to Jest configuration (#125727)
Feb 16, 2022
4bd23aa
update queries to use metricset.name and fix paths
neptunian Feb 10, 2022
93e309c
fix ccr query
neptunian Feb 11, 2022
de5b26c
fix cluster health query paths
neptunian Feb 11, 2022
6a0b7b4
update elasticsearch version mismatch
neptunian Feb 11, 2022
6375950
update fetchLicense paths
neptunian Feb 11, 2022
cdf8b24
use ecs properties in fetch_index_shard_size
klacabane Feb 15, 2022
1bed765
Fixed type error for body vs response
jasonrhodes Feb 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,23 @@
* 2.0.
*/

export const createDatasetFilter = (legacyType: string, dataset: string) => ({
/**
* metricset and dataset should match but there are currently exceptions which could just be bugs
* @param {string} type matches legacy data
* @param {string} metricset matches standalone beats
* @param {string} dataset matches agent integration data streams
*/
export const createDatasetFilter = (type: string, metricset: string, dataset: string) => ({
bool: {
should: [
{
term: {
type: legacyType,
type,
},
},
{
term: {
'metricset.name': metricset,
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,39 @@ describe('fetchCCReadExceptions', () => {
bool: {
filter: [
{
nested: {
path: 'ccr_stats.read_exceptions',
query: { exists: { field: 'ccr_stats.read_exceptions.exception' } },
bool: {
should: [
{
nested: {
Copy link
Contributor Author

@neptunian neptunian Feb 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since nested fields can't be aliased when they don't belong to the same scope, these paths would throw an error when one mapping doesnt exist, so ignoring. not sure if there is a better solution here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's how the logstash queries were designed as well so we're good as far as consistency goes :)

ignore_unmapped: true,
path: 'ccr_stats.read_exceptions',
query: {
exists: {
field: 'ccr_stats.read_exceptions.exception',
},
},
},
},
{
nested: {
ignore_unmapped: true,
path: 'elasticsearch.ccr.read_exceptions',
query: {
exists: {
field: 'elasticsearch.ccr.read_exceptions.exception',
},
},
},
},
],
minimum_should_match: 1,
},
},
{
bool: {
should: [
{ term: { type: 'ccr_stats' } },
{ term: { 'metricset.name': 'ccr' } },
{ term: { 'data_stream.dataset': 'elasticsearch.ccr' } },
],
minimum_should_match: 1,
Expand All @@ -82,9 +106,13 @@ describe('fetchCCReadExceptions', () => {
_source: {
includes: [
'cluster_uuid',
'elasticsearch.cluster.id',
'ccr_stats.read_exceptions',
'elasticsearch.ccr.read_exceptions',
'ccr_stats.shard_id',
'elasticsearch.ccr.shard_id',
'ccr_stats.leader_index',
'elasticsearch.ccr.leader.index',
],
},
size: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,35 @@ export async function fetchCCRReadExceptions(
bool: {
filter: [
{
nested: {
path: 'ccr_stats.read_exceptions',
query: {
exists: {
field: 'ccr_stats.read_exceptions.exception',
bool: {
should: [
{
nested: {
ignore_unmapped: true,
path: 'ccr_stats.read_exceptions',
query: {
exists: {
field: 'ccr_stats.read_exceptions.exception',
},
},
},
},
},
{
nested: {
ignore_unmapped: true,
path: 'elasticsearch.ccr.read_exceptions',
query: {
exists: {
field: 'elasticsearch.ccr.read_exceptions.exception',
},
},
},
},
],
minimum_should_match: 1,
},
},
createDatasetFilter('ccr_stats', 'elasticsearch.ccr'),
createDatasetFilter('ccr_stats', 'ccr', 'elasticsearch.ccr'),
{
range: {
timestamp: {
Expand Down Expand Up @@ -83,9 +102,13 @@ export async function fetchCCRReadExceptions(
_source: {
includes: [
'cluster_uuid',
'elasticsearch.cluster.id',
'ccr_stats.read_exceptions',
'elasticsearch.ccr.read_exceptions',
'ccr_stats.shard_id',
'elasticsearch.ccr.shard_id',
'ccr_stats.leader_index',
'elasticsearch.ccr.leader.index',
],
},
size: 1,
Expand Down Expand Up @@ -123,15 +146,19 @@ export async function fetchCCRReadExceptions(

for (const followerIndexBucket of followerIndicesBuckets) {
const followerIndex = followerIndexBucket.key;
const {
_index: monitoringIndexName,
_source: { ccr_stats: ccrStats, cluster_uuid: clusterUuid },
} = get(followerIndexBucket, 'hits.hits.hits[0]');
const {
read_exceptions: readExceptions,
leader_index: leaderIndex,
shard_id: shardId,
} = ccrStats;
const clusterUuid =
get(followerIndexBucket, 'hits.hits.hits[0]._source.cluster_uuid') ||
get(followerIndexBucket, 'hits.hits.hits[0]_source.elasticsearch.cluster.id');

const monitoringIndexName = get(followerIndexBucket, 'hits.hits.hits[0]._index');
const ccrStats =
get(followerIndexBucket, 'hits.hits.hits[0]._source.ccr_stats') ||
get(followerIndexBucket, 'hits.hits.hits[0]._source.elasticsearch.ccr');

const { read_exceptions: readExceptions, shard_id: shardId } = ccrStats;

const leaderIndex = ccrStats.leaderIndex || ccrStats.leader.index;

const { exception: lastReadException } = readExceptions[readExceptions.length - 1];

stats.push({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ describe('fetchClusterHealth', () => {
'*:.monitoring-es-*,.monitoring-es-*,*:metrics-elasticsearch.cluster_stats-*,metrics-elasticsearch.cluster_stats-*',
filter_path: [
'hits.hits._source.cluster_state.status',
'hits.hits._source.elasticsearch.cluster.stats.status',
'hits.hits._source.cluster_uuid',
'hits.hits._source.elasticsearch.cluster.id',
'hits.hits._index',
],
body: {
Expand All @@ -80,6 +82,7 @@ describe('fetchClusterHealth', () => {
bool: {
should: [
{ term: { type: 'cluster_stats' } },
{ term: { 'metricset.name': 'cluster_stats' } },
{ term: { 'data_stream.dataset': 'elasticsearch.cluster_stats' } },
],
minimum_should_match: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export async function fetchClusterHealth(
index: indexPatterns,
filter_path: [
'hits.hits._source.cluster_state.status',
'hits.hits._source.elasticsearch.cluster.stats.status',
'hits.hits._source.cluster_uuid',
'hits.hits._source.elasticsearch.cluster.id',
'hits.hits._index',
],
body: {
Expand All @@ -48,7 +50,7 @@ export async function fetchClusterHealth(
cluster_uuid: clusters.map((cluster) => cluster.clusterUuid),
},
},
createDatasetFilter('cluster_stats', 'elasticsearch.cluster_stats'),
createDatasetFilter('cluster_stats', 'cluster_stats', 'elasticsearch.cluster_stats'),
{
range: {
timestamp: {
Expand Down Expand Up @@ -78,8 +80,9 @@ export async function fetchClusterHealth(
const response: ElasticsearchResponse = result.body as ElasticsearchResponse;
return (response.hits?.hits ?? []).map((hit) => {
return {
health: hit._source!.cluster_state?.status,
clusterUuid: hit._source!.cluster_uuid,
health:
hit._source!.cluster_state?.status || hit._source!.elasticsearch?.cluster?.stats?.status,
clusterUuid: hit._source!.cluster_uuid || hit._source!.elasticsearch?.cluster?.id,
ccs: hit._index.includes(':') ? hit._index.split(':')[0] : undefined,
} as AlertClusterHealth;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ describe('fetchClusters', () => {
filter_path: [
'hits.hits._source.cluster_settings.cluster.metadata.display_name',
'hits.hits._source.cluster_uuid',
'hits.hits._source.elasticsearch.cluster.id',
'hits.hits._source.cluster_name',
'hits.hits._source.elasticsearch.cluster.name',
],
body: {
size: 1000,
Expand All @@ -103,6 +105,7 @@ describe('fetchClusters', () => {
bool: {
should: [
{ term: { type: 'cluster_stats' } },
{ term: { 'metricset.name': 'cluster_stats' } },
{ term: { 'data_stream.dataset': 'elasticsearch.cluster_stats' } },
],
minimum_should_match: 1,
Expand Down
57 changes: 7 additions & 50 deletions x-pack/plugins/monitoring/server/lib/alerts/fetch_clusters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ export async function fetchClusters(
filter_path: [
'hits.hits._source.cluster_settings.cluster.metadata.display_name',
'hits.hits._source.cluster_uuid',
'hits.hits._source.elasticsearch.cluster.id',
'hits.hits._source.cluster_name',
'hits.hits._source.elasticsearch.cluster.name',
],
body: {
size: 1000,
query: {
bool: {
filter: [
createDatasetFilter('cluster_stats', 'elasticsearch.cluster_stats'),
createDatasetFilter('cluster_stats', 'cluster_stats', 'elasticsearch.cluster_stats'),
{
range: rangeFilter,
},
Expand All @@ -54,61 +56,16 @@ export async function fetchClusters(
},
},
};

const { body: response } = await esClient.search(params);
return get(response, 'hits.hits', []).map((hit: any) => {
const clusterName: string =
get(hit, '_source.cluster_settings.cluster.metadata.display_name') ||
get(hit, '_source.cluster_name') ||
get(hit, '_source.cluster_uuid');
return {
clusterUuid: get(hit, '_source.cluster_uuid'),
clusterName,
};
});
}

export async function fetchClustersLegacy(
callCluster: any,
index: string,
rangeFilter: RangeFilter = { timestamp: { gte: 'now-2m' } }
): Promise<AlertCluster[]> {
const params = {
index,
filter_path: [
'hits.hits._source.cluster_settings.cluster.metadata.display_name',
'hits.hits._source.cluster_uuid',
'hits.hits._source.cluster_name',
],
body: {
size: 1000,
query: {
bool: {
filter: [
{
term: {
type: 'cluster_stats',
},
},
{
range: rangeFilter,
},
],
},
},
collapse: {
field: 'cluster_uuid',
},
},
};
const response = await callCluster('search', params);
return get(response, 'hits.hits', []).map((hit: any) => {
const clusterName: string =
get(hit, '_source.cluster_settings.cluster.metadata.display_name') ||
get(hit, '_source.cluster_name') ||
get(hit, '_source.cluster_uuid');
get(hit, '_source.elasticsearch.cluster.name') ||
get(hit, '_source.cluster_uuid') ||
get(hit, '_source.elasticsearch.cluster.id');
return {
clusterUuid: get(hit, '_source.cluster_uuid'),
clusterUuid: get(hit, '_source.cluster_uuid') || get(hit, '_source.elasticsearch.cluster.id'),
clusterName,
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ describe('fetchCpuUsageNodeStats', () => {
bool: {
should: [
{ term: { type: 'node_stats' } },
{ term: { 'metricset.name': 'node_stats' } },
{ term: { 'data_stream.dataset': 'elasticsearch.node_stats' } },
],
minimum_should_match: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function fetchCpuUsageNodeStats(
cluster_uuid: clusters.map((cluster) => cluster.clusterUuid),
},
},
createDatasetFilter('node_stats', 'elasticsearch.node_stats'),
createDatasetFilter('node_stats', 'node_stats', 'elasticsearch.node_stats'),
{
range: {
timestamp: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ describe('fetchDiskUsageNodeStats', () => {
bool: {
should: [
{ term: { type: 'node_stats' } },
{ term: { 'metricset.name': 'node_stats' } },
{ term: { 'data_stream.dataset': 'elasticsearch.node_stats' } },
],
minimum_should_match: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function fetchDiskUsageNodeStats(
cluster_uuid: clustersIds,
},
},
createDatasetFilter('node_stats', 'elasticsearch.node_stats'),
createDatasetFilter('node_stats', 'node_stats', 'elasticsearch.node_stats'),
{
range: {
timestamp: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ describe('fetchElasticsearchVersions', () => {
'*:.monitoring-es-*,.monitoring-es-*,*:metrics-elasticsearch.cluster_stats-*,metrics-elasticsearch.cluster_stats-*',
filter_path: [
'hits.hits._source.cluster_stats.nodes.versions',
'hits.hits._source.elasticsearch.cluster.stats.nodes.versions',
'hits.hits._index',
'hits.hits._source.cluster_uuid',
'hits.hits._source.elasticsearch.cluster.id',
],
body: {
size: 1,
Expand All @@ -88,6 +90,7 @@ describe('fetchElasticsearchVersions', () => {
bool: {
should: [
{ term: { type: 'cluster_stats' } },
{ term: { 'metricset.name': 'cluster_stats' } },
{ term: { 'data_stream.dataset': 'elasticsearch.cluster_stats' } },
],
minimum_should_match: 1,
Expand Down
Loading