Challenge - 5 Problems
Elasticsearch Alerting Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this Watcher alert condition?
Given the following Watcher condition script, what will be the result if the document count is 5?
{
"condition": {
"script": {
"source": "return ctx.payload.hits.total.value > 10"
}
}
}Elasticsearch
{
"condition": {
"script": {
"source": "return ctx.payload.hits.total.value > 10"
}
}
}Attempts:
2 left
💡 Hint
Think about the comparison operator and the document count value.
✗ Incorrect
The script checks if the total hits are greater than 10. Since the count is 5, the condition returns false.
🧠 Conceptual
intermediate1:30remaining
Which action type sends an email notification in Elasticsearch Watcher?
In Elasticsearch Watcher, which action type is used to send an email alert?
Attempts:
2 left
💡 Hint
Think about the action that directly sends messages to email addresses.
✗ Incorrect
The "email" action type is designed to send email notifications when a watch triggers.
❓ Predict Output
advanced2:30remaining
What is the output of this Watcher transform script?
Given this transform script in a Watcher action, what will be the output if ctx.payload.hits.hits contains two documents with fields {"status": "error"} and {"status": "ok"} respectively?
{
"transform": {
"script": {
"source": "return ctx.payload.hits.hits.stream().filter(hit -> hit._source.status == 'error').collect(Collectors.toList())"
}
}
}Elasticsearch
{
"transform": {
"script": {
"source": "return ctx.payload.hits.hits.stream().filter(hit -> hit._source.status == 'error').collect(Collectors.toList())"
}
}
}Attempts:
2 left
💡 Hint
Consider the scripting language used by Watcher and Java stream API availability.
✗ Incorrect
Watcher scripts use painless language, which does not support Java streams. This script will cause a ScriptException.
🔧 Debug
advanced3:00remaining
Why does this Watcher email action fail to send?
This Watcher email action configuration fails to send emails. What is the cause?
{
"actions": {
"send_email": {
"email": {
"to": "user@example.com",
"subject": "Alert",
"body": "There is an alert."
}
}
}
}Attempts:
2 left
💡 Hint
Check the required structure of the email body in Watcher email actions.
✗ Incorrect
The email body must be an object with a "text" key, not a plain string. This causes the failure.
🚀 Application
expert2:30remaining
How many actions will execute if this Watcher triggers?
Consider this Watcher with two actions defined:
If the Watcher condition is true, how many actions will run?
{
"actions": {
"log_error": {
"logging": {
"level": "error",
"text": "Error detected"
}
},
"notify_admin": {
"email": {
"to": ["admin@example.com"],
"subject": "Alert",
"body": {"text": "An error occurred."}
}
}
}
}If the Watcher condition is true, how many actions will run?
Attempts:
2 left
💡 Hint
By default, all actions run if the condition is met.
✗ Incorrect
When the condition is true, all defined actions execute unless throttled or disabled.