mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-07 02:15:24 +00:00
Added new parameter to switch between patterns when searching
This commit is contained in:
parent
74e0505027
commit
5e355192d3
@ -366,9 +366,19 @@ export default class ElasticWrapper {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
if(!payload) return Promise.reject(new Error('No valid payload given'));
|
if(!payload) return Promise.reject(new Error('No valid payload given'));
|
||||||
|
const pattern = payload.pattern;
|
||||||
|
delete payload.pattern;
|
||||||
|
const fullPattern = await this.getIndexPatternUsingGet(pattern);
|
||||||
|
|
||||||
|
const title = fullPattern &&
|
||||||
|
fullPattern._source &&
|
||||||
|
fullPattern._source['index-pattern'] &&
|
||||||
|
fullPattern._source['index-pattern'].title ?
|
||||||
|
fullPattern._source['index-pattern'].title :
|
||||||
|
false;
|
||||||
|
|
||||||
const data = await this.elasticRequest.callWithInternalUser('search', {
|
const data = await this.elasticRequest.callWithInternalUser('search', {
|
||||||
index: 'wazuh-alerts-3.x-*',
|
index: title || 'wazuh-alerts-3.x-*',
|
||||||
type: 'wazuh',
|
type: 'wazuh',
|
||||||
body: payload
|
body: payload
|
||||||
});
|
});
|
||||||
@ -378,7 +388,7 @@ export default class ElasticWrapper {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for the Wazuh API configuration document using its own id (usually it's a timestamp)
|
* Search for the Wazuh API configuration document using its own id (usually it's a timestamp)
|
||||||
|
Loading…
Reference in New Issue
Block a user