- X-Pack Reference for 6.0-6.2 and 5.x:
- Introduction
- Setting Up X-Pack
- Breaking Changes
- X-Pack APIs
- Graphing Connections in Your Data
- Profiling your Queries and Aggregations
- Reporting from Kibana
- Securing the Elastic Stack
- Getting Started with Security
- How Security Works
- Setting Up User Authentication
- Configuring SAML Single-Sign-On on the Elastic Stack
- Configuring Role-based Access Control
- Auditing Security Events
- Encrypting Communications
- Restricting Connections with IP Filtering
- Cross Cluster Search, Tribe, Clients and Integrations
- Reference
- Monitoring the Elastic Stack
- Alerting on Cluster and Index Events
- Machine Learning in the Elastic Stack
- Troubleshooting
- Getting Help
- X-Pack security
- Can’t log in after upgrading to 6.2.4
- Some settings are not returned via the nodes settings API
- Authorization exceptions
- Users command fails due to extra arguments
- Users are frequently locked out of Active Directory
- Certificate verification fails for curl on Mac
- SSLHandshakeException causes connections to fail
- Common SSL/TLS exceptions
- Internal Server Error in Kibana
- Setup-passwords command fails due to connection failure
- X-Pack Watcher
- X-Pack monitoring
- X-Pack machine learning
- Limitations
- License Management
- Release Notes
WARNING: Version 6.2 of the Elastic Stack has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Compare Condition
editCompare Condition
editUse the compare
condition to perform a simple comparison against a value in
the watch payload. You can use the compare
condition without enabling
dynamic scripting.
- Supported Comparison Operators
Name | Description |
---|---|
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
Using a Compare Condition
editTo use the compare
condition, you specify the value in the execution context
that you want to evaluate, a comparison operator,
and the value you want to compare against. For example, the following compare
condition returns true
if the number of the total hits in the search result is greater than or equal to 5:
Use dot notation to reference a value in the execution context. |
|
Specify a comparison operator and the value you want to compare against. |
When comparing dates and times, you can use date math expressions
of the form <{expression}>
. For example, the following expression returns
true
if the watch was executed within the last five minutes:
{ "condition" : { "compare" : { "ctx.execution_time" : { "gte" : "<{now-5m}>" } } }
You can also compare two values in the execution context by specifying the
compared value as a path of the form of {{path}}
. For example, the following
condition compares the ctx.payload.aggregations.status.buckets.error.doc_count
to the ctx.payload.aggregations.handled.buckets.true.doc_count
:
{ "condition" : { "compare" : { "ctx.payload.aggregations.status.buckets.error.doc_count" : { "not_eq" : "{{ctx.payload.aggregations.handled.buckets.true.doc_count}}" } } }
Accessing Values in the Execution Context
editYou use "dot-notation" to access values in the execution context. Values loaded
into the execution context by the input are prefixed by ctx.payload
.
You can reference entries in arrays using their zero-based array indices.
For example, to access the third element of the ctx.payload.hits.hits
array, use ctx.payload.hits.hits.2
.
Name | Description |
---|---|
|
The id of the watch that is currently executing. |
|
The time execution of this watch started. |
|
The time this watch was triggered. |
|
The time this watch was supposed to be triggered. |
|
Any metadata associated with the watch. |
|
The payload data loaded by the watch’s input. |
ElasticON events are back!
Learn about the Elastic Search AI Platform from the experts at our live events.
Register now