Skip to content

Commit 22eacc6

Browse files
mike's input
1 parent 88a17db commit 22eacc6

File tree

2 files changed

+55
-53
lines changed

2 files changed

+55
-53
lines changed

explore-analyze/alerts-cases/alerts/rule-type-es-query.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ When you create an {{es}} query rule, your choice of query type affects the info
2626

2727
1. Define your query
2828

29-
If you use [query DSL](../../query-filter/languages/querydsl.md), you must select an index and time field then provide your query. Only the `query`, `fields`, `_source` and `runtime_mappings` fields are used, other DSL fields are not considered. For example:
29+
* If you use [query DSL](../../query-filter/languages/querydsl.md), you must select an index and time field then provide your query. Only the `query`, `fields`, `_source` and `runtime_mappings` fields are used, other DSL fields are not considered. For example:
3030

3131
```sh
3232
{
@@ -36,44 +36,44 @@ When you create an {{es}} query rule, your choice of query type affects the info
3636
}
3737
```
3838

39-
If you use [KQL](../../query-filter/languages/kql.md) or [Lucene](../../query-filter/languages/lucene-query-syntax.md), you must specify a data view then define a text-based query. For example, `http.request.referrer: "https://example.com"`.
39+
* If you use [KQL](../../query-filter/languages/kql.md) or [Lucene](../../query-filter/languages/lucene-query-syntax.md), you must specify a data view then define a text-based query. For example, `http.request.referrer: "https://example.com"`.
4040

41-
If you use [ES|QL](../../query-filter/languages/esql.md), you must provide a source command followed by an optional series of processing commands, separated by pipe characters (|).
41+
* If you use [ES|QL](../../query-filter/languages/esql.md), you must provide a source command followed by an optional series of processing commands, separated by pipe characters (|).
4242

43-
:::{admonition} Added in 8.16.0
44-
This functionality was added in 8.16.0.
45-
:::
43+
:::{admonition} Added in 8.16.0
44+
This functionality was added in 8.16.0.
45+
:::
4646

47-
For example:
47+
For example:
4848

49-
```sh
50-
FROM kibana_sample_data_logs
51-
| STATS total_bytes = SUM(bytes) BY host
52-
| WHERE total_bytes > 200000
53-
| SORT total_bytes DESC
54-
| LIMIT 10
55-
```
49+
```sh
50+
FROM kibana_sample_data_logs
51+
| STATS total_bytes = SUM(bytes) BY host
52+
| WHERE total_bytes > 200000
53+
| SORT total_bytes DESC
54+
| LIMIT 10
55+
```
5656

5757
2. Specify details for grouping alerts based on your query language.
5858

59-
If you use query DSL, KQL, or Lucene, set the group and theshold.
59+
* If you use query DSL, KQL, or Lucene, set the group and theshold.
6060

61-
When
62-
: Specify how to calculate the value that is compared to the threshold. The value is calculated by aggregating a numeric field within the time window. The aggregation options are: `count`, `average`, `sum`, `min`, and `max`. When using `count` the document count is used and an aggregation field is not necessary.
61+
When
62+
: Specify how to calculate the value that is compared to the threshold. The value is calculated by aggregating a numeric field within the time window. The aggregation options are: `count`, `average`, `sum`, `min`, and `max`. When using `count` the document count is used and an aggregation field is not necessary.
6363

64-
Over or Grouped Over
65-
: Specify whether the aggregation is applied over all documents or split into groups using up to four grouping fields. If you choose to use grouping, it’s a [terms](elasticsearch://reference/aggregations/search-aggregations-bucket-terms-aggregation.md) or [multi terms aggregation](elasticsearch://reference/aggregations/search-aggregations-bucket-multi-terms-aggregation.md); an alert will be created for each unique set of values when it meets the condition. To limit the number of alerts on high cardinality fields, you must specify the number of groups to check against the threshold. Only the top groups are checked.
64+
Over or Grouped Over
65+
: Specify whether the aggregation is applied over all documents or split into groups using up to four grouping fields. If you choose to use grouping, it’s a [terms](elasticsearch://reference/aggregations/search-aggregations-bucket-terms-aggregation.md) or [multi terms aggregation](elasticsearch://reference/aggregations/search-aggregations-bucket-multi-terms-aggregation.md); an alert will be created for each unique set of values when it meets the condition. To limit the number of alerts on high cardinality fields, you must specify the number of groups to check against the threshold. Only the top groups are checked.
6666

67-
Threshold
68-
: Defines a threshold value and a comparison operator (`is above`, `is above or equals`, `is below`, `is below or equals`, or `is between`). The value calculated by the aggregation is compared to this threshold.
67+
Threshold
68+
: Defines a threshold value and a comparison operator (`is above`, `is above or equals`, `is below`, `is below or equals`, or `is between`). The value calculated by the aggregation is compared to this threshold.
6969

70-
{applies_to}`stack: ga 9.2` If you use {{esql}}, specify a time field and how to group alerts.
70+
* {applies_to}`stack: ga 9.2` If you use {{esql}}, specify a time field and how to group alerts.
7171

72-
Time field
73-
: Choose the time field to use when filtering query results by the time window that you later specify for the rule. You can choose any time field that's availble on the index you're querying, for example, the `@timestamp` field.
72+
Time field
73+
: Choose the time field to use when filtering query results by the time window that you later specify for the rule. You can choose any time field that's availble on the index you're querying, for example, the `@timestamp` field.
7474

75-
Alert group
76-
: Select **Create an alert if matches are found** to create a single alert for multiple events matching the {{esql}} query. Select **Create an alert for each row** to create a separate alert for each event that matches the {{esql}} query. Whenever possible, each alert is given a unique ID.
75+
Alert group
76+
: Select **Create an alert if matches are found** to create a single alert for multiple events matching the {{esql}} query. Select **Create an alert for each row** to create a separate alert for each event that matches the {{esql}} query. Whenever possible, each alert is given a unique ID.
7777

7878

7979
3. Set the time window, which defines how far back to search for documents.

solutions/observability/incident-management/create-an-elasticsearch-query-rule.md

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,48 +41,50 @@ When you create an {{es}} query rule, your choice of query type affects the info
4141

4242
1. Define your query
4343

44-
If you use [query DSL](/explore-analyze/query-filter/languages/querydsl.md), you must select an index and time field then provide your query. Only the `query`, `fields`, `_source` and `runtime_mappings` fields are used, other DSL fields are not considered. For example:
44+
* If you use [query DSL](../../../explore-analyze/query-filter/languages/querydsl.md), you must select an index and time field then provide your query. Only the `query`, `fields`, `_source` and `runtime_mappings` fields are used, other DSL fields are not considered. For example:
4545

4646
```sh
4747
{
48-
"query":{
49-
"match_all" : {}
50-
}
51-
}
48+
"query":{
49+
"match_all" : {}
50+
}
51+
}
5252
```
5353

54-
If you use [KQL](/explore-analyze/query-filter/languages/kql.md) or [Lucene](/explore-analyze/query-filter/languages/lucene-query-syntax.md), you must specify a data view then define a text-based query. For example, `http.request.referrer: "https://example.com"`.
54+
* If you use [KQL](../../../explore-analyze/query-filter/languages/kql.md) or [Lucene](../../../explore-analyze/query-filter/languages/lucene-query-syntax.md), you must specify a data view then define a text-based query. For example, `http.request.referrer: "https://example.com"`.
5555

56-
If you use [ES|QL](/explore-analyze/query-filter/languages/esql.md), you must provide a source command followed by an optional series of processing commands, separated by pipe characters (|). For example:
56+
* If you use [ES|QL](../../../explore-analyze/query-filter/languages/esql.md), you must provide a source command followed by an optional series of processing commands, separated by pipe characters (|).
5757

58-
```sh
59-
FROM kibana_sample_data_logs
60-
| STATS total_bytes = SUM(bytes) BY host
61-
| WHERE total_bytes > 200000
62-
| SORT total_bytes DESC
63-
| LIMIT 10
64-
```
58+
For example:
59+
60+
```sh
61+
FROM kibana_sample_data_logs
62+
| STATS total_bytes = SUM(bytes) BY host
63+
| WHERE total_bytes > 200000
64+
| SORT total_bytes DESC
65+
| LIMIT 10
66+
```
6567

66-
2. Specify details for grouping alerts.
68+
2. Specify details for grouping alerts based on your query language.
6769

68-
If you use query DSL, KQL, or Lucene, set the group and theshold.
70+
* If you use query DSL, KQL, or Lucene, set the group and theshold.
6971

70-
When
71-
: Specify how to calculate the value that is compared to the threshold. The value is calculated by aggregating a numeric field within the time window. The aggregation options are: `count`, `average`, `sum`, `min`, and `max`. When using `count` the document count is used and an aggregation field is not necessary.
72+
When
73+
: Specify how to calculate the value that is compared to the threshold. The value is calculated by aggregating a numeric field within the time window. The aggregation options are: `count`, `average`, `sum`, `min`, and `max`. When using `count` the document count is used and an aggregation field is not necessary.
7274

73-
Over or Grouped Over
74-
: Specify whether the aggregation is applied over all documents or split into groups using up to four grouping fields. If you choose to use grouping, it’s a [terms](elasticsearch://reference/aggregations/search-aggregations-bucket-terms-aggregation.md) or [multi terms aggregation](elasticsearch://reference/aggregations/search-aggregations-bucket-multi-terms-aggregation.md); an alert will be created for each unique set of values when it meets the condition. To limit the number of alerts on high cardinality fields, you must specify the number of groups to check against the threshold. Only the top groups are checked.
75+
Over or Grouped Over
76+
: Specify whether the aggregation is applied over all documents or split into groups using up to four grouping fields. If you choose to use grouping, it’s a [terms](elasticsearch://reference/aggregations/search-aggregations-bucket-terms-aggregation.md) or [multi terms aggregation](elasticsearch://reference/aggregations/search-aggregations-bucket-multi-terms-aggregation.md); an alert will be created for each unique set of values when it meets the condition. To limit the number of alerts on high cardinality fields, you must specify the number of groups to check against the threshold. Only the top groups are checked.
7577

76-
Threshold
77-
: Defines a threshold value and a comparison operator (`is above`, `is above or equals`, `is below`, `is below or equals`, or `is between`). The value calculated by the aggregation is compared to this threshold.
78+
Threshold
79+
: Defines a threshold value and a comparison operator (`is above`, `is above or equals`, `is below`, `is below or equals`, or `is between`). The value calculated by the aggregation is compared to this threshold.
7880

79-
{applies_to}`stack: ga 9.2` If you use {{esql}}, specify a time field and how to group alerts.
81+
* {applies_to}`stack: ga 9.2` If you use {{esql}}, specify a time field and how to group alerts.
8082

81-
Time field
82-
: Choose the time field to use when filtering query results by the time window that you later specify for the rule. You can choose any time field that's availble on the index you're querying, for example, the `@timestamp` field.
83+
Time field
84+
: Choose the time field to use when filtering query results by the time window that you later specify for the rule. You can choose any time field that's availble on the index you're querying, for example, the `@timestamp` field.
8385

84-
Alert group
85-
: Select **Create an alert if matches are found** to create a single alert for multiple events matching the {{esql}} query. Select **Create an alert for each row** to create a separate alert for each event that matches the {{esql}} query. Whenever possible, each alert is given a unique ID.
86+
Alert group
87+
: Select **Create an alert if matches are found** to create a single alert for multiple events matching the {{esql}} query. Select **Create an alert for each row** to create a separate alert for each event that matches the {{esql}} query. Whenever possible, each alert is given a unique ID.
8688

8789
3. Set the time window, which defines how far back to search for documents.
8890
4. If you use query DSL, KQL, or Lucene, set the number of documents to send to the configured actions when the threshold condition is met.

0 commit comments

Comments
 (0)