67 lines
1.2 KiB
JavaScript
67 lines
1.2 KiB
JavaScript
|
/**
|
||
|
* @param options
|
||
|
* @constructor
|
||
|
*/
|
||
|
SOC.Query.AlertDashboard = function(
|
||
|
options
|
||
|
) {
|
||
|
|
||
|
if (!options) {
|
||
|
options = {};
|
||
|
}
|
||
|
|
||
|
if (!options.path) {
|
||
|
options.path = '/alerts/_search';
|
||
|
}
|
||
|
|
||
|
if (!options.query) {
|
||
|
options.query = {
|
||
|
"version": false,
|
||
|
"size": 0,
|
||
|
"sort": [
|
||
|
{
|
||
|
"timestamp": {
|
||
|
"order": "desc",
|
||
|
"unmapped_type": "boolean"
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
"_source": {
|
||
|
"includes": ["*"]
|
||
|
},
|
||
|
"aggs": {
|
||
|
"priorities": {
|
||
|
"histogram": {
|
||
|
"field": "priority",
|
||
|
"interval": "1",
|
||
|
"min_doc_count": 0
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
"query": {
|
||
|
"bool": {
|
||
|
"must": [
|
||
|
{
|
||
|
"range": {
|
||
|
"timestamp": {
|
||
|
"format": "strict_date_optional_time",
|
||
|
"gte": "%QUERY_START",
|
||
|
"lt": "%QUERY_END"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
SOC.Query.call(
|
||
|
this,
|
||
|
options
|
||
|
);
|
||
|
};
|
||
|
|
||
|
SOC.Query.AlertDashboard.prototype = Object.create(SOC.Query.prototype);
|
||
|
SOC.Query.AlertDashboard.prototype.constructor = SOC.Query;
|