Skip to content

Commit 17f45a6

Browse files
committed
20234 FIX Correct inline help of check_elasticsearch_query search pattern and field names
The inline help of the active check "Query elasticsearch logs" (`check_elasticsearch_query`) described the wrong query syntax. The "Search pattern" field claimed that the Kibana query language (KQL) could be used and linked to the KQL documentation. This was never the case: the check sends the pattern verbatim as an Elasticsearch `query_string` query to the `_count` API. The query string syntax is similar to KQL, but a distinct and separate language. The help now links to the query string documentation and points out that regular expressions can be embedded by wrapping them in forward slashes. The "Fieldnames to query" field claimed that regexp queries were allowed and linked to the `regexp` query documentation. The entered field names are passed to the `fields` parameter of the same `query_string` query, which supports wildcards, not regular expressions. The `regexp` query documented under the old link matches values within a single named field and is never issued by this check. The help now describes wildcards and links to the query string documentation. This is a documentation fix only, the behavior of the check is unchanged. CMK-32227 Change-Id: Ic4cbbe486150a43298f6f4d27c7ad23f3900d79a
1 parent 6e05b2e commit 17f45a6

2 files changed

Lines changed: 34 additions & 5 deletions

File tree

.werks/20234.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[//]: # (werk v2)
2+
# Correct inline help of check_elasticsearch_query search pattern and field names
3+
4+
key | value
5+
---------- | ---
6+
date | 2026-08-07T05:13:25.426372+00:00
7+
version | 2.4.0p36
8+
class | fix
9+
edition | cre
10+
component | checks
11+
level | 1
12+
compatible | yes
13+
14+
The inline help of the active check "Query elasticsearch logs" (`check_elasticsearch_query`) described the wrong query syntax.
15+
16+
The "Search pattern" field claimed that the Kibana query language (KQL) could be used and linked to the KQL documentation.
17+
This was never the case: the check sends the pattern verbatim as an Elasticsearch `query_string` query to the `_count` API.
18+
The query string syntax is similar to KQL, but a distinct and separate language.
19+
The help now links to the query string documentation and points out that regular expressions can be embedded by wrapping them in forward slashes.
20+
21+
The "Fieldnames to query" field claimed that regexp queries were allowed and linked to the `regexp` query documentation.
22+
The entered field names are passed to the `fields` parameter of the same `query_string` query, which supports wildcards, not regular expressions.
23+
The `regexp` query documented under the old link matches values within a single named field and is never issued by this check.
24+
The help now describes wildcards and links to the query string documentation.
25+
26+
This is a documentation fix only, the behavior of the check is unchanged.

cmk/plugins/elasticsearch/rulesets/elasticsearch_query.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,12 @@ def _parameter_form() -> Dictionary:
103103
title=Title("Search pattern"),
104104
help_text=Help(
105105
"Here you can define what search pattern should be used. "
106-
"You can use Kibana query language as described "
107-
'<a href="https://www.elastic.co/guide/en/kibana/current/kuery-query.html"'
108-
'target="_blank">here</a>. To optimize search speed, use defined indices and fields '
106+
"You can use the Elasticsearch query string syntax as described "
107+
'<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html"'
108+
'target="_blank">here</a>. Note that this is not the Kibana query language (KQL). '
109+
"Regular expressions are supported by wrapping them in forward slashes, "
110+
"for example <tt>name:/joh?n(ath[oa]n)/</tt>. "
111+
"To optimize search speed, use defined indices and fields "
109112
"otherwise all indices and fields will be searched."
110113
),
111114
),
@@ -130,8 +133,8 @@ def _parameter_form() -> Dictionary:
130133
title=Title("Fieldnames to query"),
131134
help_text=Help(
132135
"Here you can define fieldnames that should be used "
133-
"in the search. Regexp query is allowed as described "
134-
'<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html"'
136+
"in the search. Wildcards are allowed as described "
137+
'<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html"'
135138
'target="_blank">here</a>. If you want to speed up your search, '
136139
"use defined indices."
137140
),

0 commit comments

Comments
 (0)