Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
67fcaeb
Add operations for the different search types
carlosdelest Mar 13, 2025
980892b
First test that does just indexing and search
carlosdelest Mar 13, 2025
e606f6e
First test that does just indexing and search
carlosdelest Mar 13, 2025
d979c6b
Default warmup restored
carlosdelest Mar 14, 2025
12ee496
Add ESQL queries to elastic/logs
carlosdelest Mar 14, 2025
abb7987
Fix queries
carlosdelest Mar 17, 2025
769fb63
Use many shards setup
carlosdelest Mar 17, 2025
a6dbb41
Small fix
carlosdelest Mar 18, 2025
5abeb81
Added configuration for search clients and warmup iterations
carlosdelest Mar 18, 2025
a430a0a
Changed queries to ensure we get results back
carlosdelest Mar 19, 2025
26bfe31
Restore default wikipedia challenge, add new one
carlosdelest Mar 20, 2025
e552e73
Fix LIMIT in ESQL query
carlosdelest Mar 20, 2025
fe9c146
Linting
carlosdelest Mar 21, 2025
b93b727
Fix queries so they are equivalent, add LIKE queries for ESQL
carlosdelest Mar 27, 2025
e8eacaa
Fix size and cache
carlosdelest Apr 1, 2025
e64f2f8
Add proper log prefix
carlosdelest Apr 1, 2025
8b049c4
Fix size again
carlosdelest Apr 1, 2025
7e674df
Merge branch 'refs/heads/master' into feature/esql-full-text-functions
carlosdelest Apr 2, 2025
77dbca7
Remove duplicate file
carlosdelest Apr 2, 2025
b50f595
Undo unintended changes
carlosdelest Apr 2, 2025
ef758de
Merge remote-tracking branch 'origin/master' into feature/esql-full-t…
carlosdelest Jun 2, 2025
058ccbf
Remove source filtering and KEEP for ES|QL queries
carlosdelest Jun 2, 2025
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
52 changes: 40 additions & 12 deletions elastic/logs/challenges/logging-querying-esql.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,70 +80,98 @@
"clients": {{ p_search_clients }},
"warmup-iterations": {{ warmup_iterations | default(20) }},
"iterations": {{ iterations | default(100) }},
"tags": ["esql", "search"]
"tags": ["esql", "full-text"]
},
{
"operation": "kafka_match_esql_query",
"operation": "apache_equals_esql_query",
"clients": {{ p_search_clients }},
"warmup-iterations": {{ warmup_iterations | default(20) }},
"iterations": {{ iterations | default(100) }},
"tags": ["esql", "search"]
"tags": ["esql", "like"]
},
{
"operation": "kafka_qstr_esql_query",
"clients": {{ p_search_clients }},
"warmup-iterations": {{ warmup_iterations | default(20) }},
"iterations": {{ iterations | default(100) }},
"tags": ["esql", "full-text"]
},
{
"operation": "kafka_like_esql_query",
"clients": {{ p_search_clients }},
"warmup-iterations": {{ warmup_iterations | default(20) }},
"iterations": {{ iterations | default(100) }},
"tags": ["esql", "like"]
},
{
"operation": "qstr_esql_query",
"clients": {{ p_search_clients }},
"warmup-iterations": {{ warmup_iterations | default(20) }},
"iterations": {{ iterations | default(100) }},
"tags": ["esql", "search"]
"tags": ["esql", "full-text"]
},
{
"operation": "kql_esql_query",
"clients": {{ p_search_clients }},
"warmup-iterations": {{ warmup_iterations | default(20) }},
"iterations": {{ iterations | default(100) }},
"tags": ["esql", "search"]
"tags": ["esql", "full-text"]
},
{
"operation": "kql_like_esql_query",
"clients": {{ p_search_clients }},
"warmup-iterations": {{ warmup_iterations | default(20) }},
"iterations": {{ iterations | default(100) }},
"tags": ["esql", "like"]
},
{
"operation": "syslog_qstr_esql_query",
"clients": {{ p_search_clients }},
"warmup-iterations": {{ warmup_iterations | default(20) }},
"iterations": {{ iterations | default(100) }},
"tags": ["esql", "search"]
"tags": ["esql", "full-text"]
},
{
"operation": "syslog_like_esql_query",
"clients": {{ p_search_clients }},
"warmup-iterations": {{ warmup_iterations | default(20) }},
"iterations": {{ iterations | default(100) }},
"tags": ["esql", "like"]
}{%- if build_flavor != "serverless" or serverless_operator == true %},
{
"operation": "apache_match_query_dsl_query",
"clients": {{ p_search_clients }},
"warmup-iterations": {{ warmup_iterations | default(20) }},
"iterations": {{ iterations | default(100) }},
"tags": ["search"]
"tags": ["search", "full-text"]
},
{
"operation": "kafka_query_dsl_query",
"operation": "kafka_qstr_dsl_query",
"clients": {{ p_search_clients }},
"warmup-iterations": {{ warmup_iterations | default(20) }},
"iterations": {{ iterations | default(100) }},
"tags": ["search"]
"tags": ["search", "full-text"]
},
{
"operation": "qstr_query_dsl_query",
"clients": {{ p_search_clients }},
"warmup-iterations": {{ warmup_iterations | default(20) }},
"iterations": {{ iterations | default(100) }},
"tags": ["search"]
"tags": ["search", "full-text"]
},
{
"operation": "kql_query_dsl_query",
"clients": {{ p_search_clients }},
"warmup-iterations": {{ warmup_iterations | default(20) }},
"iterations": {{ iterations | default(100) }},
"tags": ["search"]
"tags": ["search", "full-text"]
},
{
"operation": "syslog_query_dsl_query",
"clients": {{ p_search_clients }},
"warmup-iterations": {{ warmup_iterations | default(20) }},
"iterations": {{ iterations | default(100) }},
"tags": ["search"]
"tags": ["search", "full-text"]
},
{
"operation": "enable_query_cache",
Expand Down
171 changes: 154 additions & 17 deletions elastic/logs/operations/esql-full-text-search.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,30 @@
{
"name": "apache_match_esql_query",
"operation-type": "esql",
"query": "FROM {{p_esql_target_prefix}}logs-* | WHERE event.dataset: \"apache.access\" AND http.response.status_code: 404 AND user_agent.name: \"Firefox\" | EVAL start_time = DATE_PARSE(\"yyyy-MM-dd\",\"{{ bulk_start_date }}\"), end_time = DATE_PARSE(\"yyyy-MM-dd\",\"{{ bulk_end_date }}\") | WHERE @timestamp >= start_time AND @timestamp <= end_time | SORT @timestamp DESC | LIMIT 20"
"query": "FROM {{p_esql_target_prefix}}logs-*| WHERE event.dataset: \"apache.access\" AND http.response.status_code: 404 AND user_agent.name: \"Firefox\" | SORT @timestamp DESC | LIMIT 500",
"filter": {
"range": {
"@timestamp": {
"format": "strict_date_optional_time",
"gte": "{{bulk_start_date}}T09:10:05.477Z",
"lte": "{{bulk_end_date}}T21:10:05.477Z"
}
}
}
},
{
"name": "apache_equals_esql_query",
"operation-type": "esql",
"query": "FROM {{p_esql_target_prefix}}logs-* | WHERE event.dataset == \"apache.access\" AND http.response.status_code == 404 AND user_agent.name == \"Firefox\" | SORT @timestamp DESC | LIMIT 500",
"filter": {
"range": {
"@timestamp": {
"format": "strict_date_optional_time",
"gte": "{{bulk_start_date}}T09:10:05.477Z",
"lte": "{{bulk_end_date}}T21:10:05.477Z"
}
}
}
},
{
"name": "apache_match_query_dsl_query",
Expand Down Expand Up @@ -48,16 +71,47 @@
"should": [],
"must_not": []
}
},
"size": 500,
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
]
}
},
{
"name": "kafka_qstr_esql_query",
"operation-type": "esql",
"query": "FROM {{p_esql_target_prefix}}logs-* | WHERE QSTR(\"event.dataset: kafka.log AND Connection * disconnected\") | SORT @timestamp DESC | LIMIT 500",
"filter": {
"range": {
"@timestamp": {
"format": "strict_date_optional_time",
"gte": "{{bulk_start_date}}T09:10:05.477Z",
"lte": "{{bulk_end_date}}T21:52:08.615Z"
}
}
}
},
{
"name": "kafka_match_esql_query",
"name": "kafka_like_esql_query",
"operation-type": "esql",
"query": "FROM {{p_esql_target_prefix}}logs-* | WHERE event.dataset: \"kafka.log\" AND QSTR(\"Connection * disconnected\") | EVAL start_time = DATE_PARSE(\"yyyy-MM-dd\",\"{{ bulk_start_date }}\"), end_time = DATE_PARSE(\"yyyy-MM-dd\",\"{{ bulk_end_date }}\") | WHERE @timestamp >= start_time AND @timestamp <= end_time | SORT @timestamp DESC | LIMIT 500"
"query": "FROM {{p_esql_target_prefix}}logs-* | WHERE event.dataset == \"kafka.log\" AND message LIKE \"Connection * disconnected\" | SORT @timestamp DESC | LIMIT 500",
"filter": {
"range": {
"@timestamp": {
"format": "strict_date_optional_time",
"gte": "{{bulk_start_date}}T09:10:05.477Z",
"lte": "{{bulk_end_date}}T21:52:08.615Z"
}
}
}
},
{
"name": "kafka_query_dsl_query",
"name": "kafka_qstr_dsl_query",
"operation-type": "search",
"index": "{{p_esql_target_prefix}}logs-*",
"body": {
Expand All @@ -69,8 +123,8 @@
"bool": {
"should": [
{
"exists": {
"field": "kafka.log.trace.class"
"query_string": {
"query": "event.dataset: kafka.log"
}
}
],
Expand All @@ -86,7 +140,7 @@
"range": {
"@timestamp": {
"format": "strict_date_optional_time",
"gte": "{{bulk_start_date}}T21:52:08.615Z",
"gte": "{{bulk_start_date}}T09:10:05.477Z",
"lte": "{{bulk_end_date}}T21:52:08.615Z"
}
}
Expand All @@ -96,13 +150,29 @@
"must_not": []
}
},
"size": 500
"size": 500,
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
]
}
},
{
"name": "qstr_esql_query",
"operation-type": "esql",
"query": "FROM {{p_esql_target_prefix}}logs-* | WHERE qstr(\"slack\", {\"default_field\": \"*\"}) | EVAL start_time = DATE_PARSE(\"yyyy-MM-dd\",\"{{ bulk_start_date }}\"), end_time = DATE_PARSE(\"yyyy-MM-dd\",\"{{ bulk_end_date }}\") | WHERE @timestamp >= start_time AND @timestamp <= end_time | LIMIT 500"
"query": "FROM {{p_esql_target_prefix}}logs-* | WHERE QSTR(\"slack\") | SORT @timestamp DESC | LIMIT 500",
"filter": {
"range": {
"@timestamp": {
"format": "strict_date_optional_time",
"gte": "{{bulk_start_date}}T21:52:08.615Z",
"lte": "{{bulk_end_date}}T21:52:08.615Z"
}
}
}
},
{
"name": "qstr_query_dsl_query",
Expand Down Expand Up @@ -132,13 +202,43 @@
"must_not": []
}
},
"size": 500
"size": 500,
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
]
}
},
{
"name": "kql_esql_query",
"operation-type": "esql",
"query": "FROM {{p_esql_target_prefix}}logs-* | WHERE kql(\"query\") | EVAL start_time = DATE_PARSE(\"yyyy-MM-dd\",\"{{ bulk_start_date }}\"), end_time = DATE_PARSE(\"yyyy-MM-dd\",\"{{ bulk_end_date }}\") | WHERE @timestamp >= start_time AND @timestamp <= end_time | LIMIT 500"
"query": "FROM {{p_esql_target_prefix}}logs-* | WHERE kql(\"query\") | SORT @timestamp DESC | LIMIT 500",
"filter": {
"range": {
"@timestamp": {
"format": "strict_date_optional_time",
"gte": "{{bulk_start_date}}T07:52:08.615Z",
"lte": "{{bulk_end_date}}T07:52:08.615Z"
}
}
}
},
{
"name": "kql_like_esql_query",
"operation-type": "esql",
"query": "FROM {{p_esql_target_prefix}}logs-* | WHERE message like \"*query*\" | SORT @timestamp DESC | LIMIT 500",
"filter": {
"range": {
"@timestamp": {
"format": "strict_date_optional_time",
"gte": "{{bulk_start_date}}T07:52:08.615Z",
"lte": "{{bulk_end_date}}T07:52:08.615Z"
}
}
}
},
{
"name": "kql_query_dsl_query",
Expand Down Expand Up @@ -168,20 +268,49 @@
"must_not": []
}
},
"size": 500
"size": 500,
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
]
}
},
{
"name": "syslog_qstr_esql_query",
"operation-type": "esql",
"query": "FROM {{p_esql_target_prefix}}logs-* | WHERE event.dataset: \"system.syslog\" AND qstr(\"Stopped*\") | EVAL start_time = DATE_PARSE(\"yyyy-MM-dd\",\"{{ bulk_start_date }}\"), end_time = DATE_PARSE(\"yyyy-MM-dd\",\"{{ bulk_end_date }}\") | WHERE @timestamp >= start_time AND @timestamp <= end_time | LIMIT 100"
"query": "FROM {{p_esql_target_prefix}}logs-* | WHERE QSTR(\"event.dataset: system.syslog\") AND QSTR(\"Stopped*\") | SORT @timestamp DESC | LIMIT 500",
"filter": {
"range": {
"@timestamp": {
"format": "strict_date_optional_time",
"gte": "{{bulk_start_date}}T20:13:05.675Z",
"lte": "{{bulk_end_date}}T20:13:05.675Z"
}
}
}
},
{
"name": "syslog_like_esql_query",
"operation-type": "esql",
"query": "FROM {{p_esql_target_prefix}}logs-* | WHERE event.dataset == \"system.syslog\" AND message LIKE \"Stopped*\" | SORT @timestamp DESC | LIMIT 500",
"filter": {
"range": {
"@timestamp": {
"format": "strict_date_optional_time",
"gte": "{{bulk_start_date}}T20:13:05.675Z",
"lte": "{{bulk_end_date}}T20:13:05.675Z"
}
}
}
},
{
"name": "syslog_query_dsl_query",
"operation-type": "search",
"index": "{{p_esql_target_prefix}}logs-*",
"body": {
"size": 100,
"query": {
"bool": {
"filter": [
Expand All @@ -192,8 +321,8 @@
"bool": {
"should": [
{
"match": {
"event.dataset": "system.syslog"
"query_string": {
"query": "event.dataset: system.syslog"
}
}
],
Expand Down Expand Up @@ -228,6 +357,14 @@
"should": [],
"must_not": []
}
}
},
"size": 500,
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
]
}
}
2 changes: 1 addition & 1 deletion wikipedia/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def params(self):
raise ValueError("Unknown query type: " + self._query_type)

return {
"query": f"FROM {self._index_name} METADATA _score | WHERE { query_body } | KEEP title, _score | SORT _score DESC | LIMIT { self._size }",
"query": f"FROM {self._index_name} METADATA _score | WHERE { query_body } | SORT _score DESC | LIMIT { self._size }",
}

except StopIteration:
Expand Down
Loading