Skip to content

Commit bf922d8

Browse files
fix build errors
1 parent 9b9cc55 commit bf922d8

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

manage-data/ingest/transform-enrich/common-mistakes.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ Once you've checked `ctx.user?.geo?.region != null`, you can safely access `ctx.
150150

151151
#### ![do](../../images/icon-check.svg) **Do**: Use `.isEmpty()` for strings
152152

153-
To check if a string field is not empty, use the [`isEmpty()` method](elasticsearch://reference/scripting-languages/painless/painless#painless-api-reference-string) in your condition. For example:
153+
% TO DO: Find link to `isEmpty()` method
154+
To check if a string field is not empty, use the `isEmpty()` method in your condition. For example:
154155

155156
```painless
156157
"if": "ctx.user?.geo?.region instanceof String && ctx.user.geo.region.isEmpty() == false"
@@ -159,7 +160,7 @@ To check if a string field is not empty, use the [`isEmpty()` method](elasticsea
159160
This ensures the field exists, is a string, and is not empty.
160161

161162
:::{tip}
162-
For such checks you can also ommit the `instanceof String` and use an [`Elvis`](elasticsearch://reference/scripting-languages/painless/painless-operators-reference#elvis-operator) such as `if: ctx.user?.geo?.region?.isEmpty() ?: false`. This will only work when region is a String. If it is a double, object or any other type that does not have an `isEmpty()`function it will fail with a `Java Function not found` error.
163+
For such checks you can also ommit the `instanceof String` and use an [`Elvis`](elasticsearch://reference/scripting-languages/painless/painless-operators-reference.md#elvis-operator) such as `if: ctx.user?.geo?.region?.isEmpty() ?: false`. This will only work when region is a String. If it is a double, object or any other type that does not have an `isEmpty()`function it will fail with a `Java Function not found` error.
163164
:::
164165

165166
Here is a full reproducible example:

manage-data/ingest/transform-enrich/general-tips.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ You see that I switched up the null value to an empty String. Since the String h
101101

102102
One common thing I use it for is when dealing with numbers and casting. The field specifies the usage in `%`, however Elasticsearch doesn't like this, or better to say Kibana renders % as `0-1` for `0%-100%` and not `0-100`. `100` is equal to `10.000%`
103103

104-
- field: `cpu_usage = 100.00`
104+
- field: `cpu_usage = 100.00`
105105
- `ctx.cpu.usage = $('cpu_usage',0.0)/100`
106106

107107
This allows me to always set the `cpu.usage` field and not to worry about it, have an always working division. One other way to leverage this, in a simpler script is like this, but most scripts are rather complex so this is not that often applicable.
@@ -117,7 +117,7 @@ This allows me to always set the `cpu.usage` field and not to worry about it, ha
117117

118118
## Check if a value exists and is not null
119119

120-
In simplest case the `ignore_empty_value` parameter is available in most processors to handle fields without values. Or the `ignore_failure` parameter to let the processor fail without impacting the pipeline you but sometime you will need to use the [null safe operator `?.`](elasticsearch::/references/painless/current/painless-operators-reference.html#null-safe-operator) to check if a field exists and is not `null`.
120+
In simplest case the `ignore_empty_value` parameter is available in most processors to handle fields without values. Or the `ignore_failure` parameter to let the processor fail without impacting the pipeline you but sometime you will need to use the [null safe operator `?.`](elasticsearch://reference/scripting-languages/painless/painless-operators-reference.md#null-safe-operator) to check if a field exists and is not `null`.
121121

122122
```json
123123
POST _ingest/pipeline/_simulate
@@ -179,7 +179,7 @@ An [elvis](https://www.elastic.co/guide/en/elasticsearch/painless/current/painle
179179

180180
Most safest and secure option is to write:
181181

182-
- `ctx.message instanceof String && ctx.message.startsWith('shoe')`
182+
- `ctx.message instanceof String && ctx.message.startsWith('shoe')`
183183
- `ctx.event?.category instanceof String && ctx.event.category.startsWith('shoe')`
184184

185185
The reason for that is, if `event.category` is a number, object or anything other than a `String` then it does not have the `startsWith` function and therefore will error with function `startsWith` not available on type object.
@@ -306,7 +306,7 @@ POST _ingest/pipeline/_simulate
306306
}
307307
}
308308
}
309-
],
309+
],
310310
"pipeline": {
311311
"processors": [
312312
{
@@ -336,7 +336,7 @@ POST _ingest/pipeline/_simulate
336336
"@timestamp": "2021-08-13T09:06:00.000Z"
337337
}
338338
}
339-
],
339+
],
340340
"pipeline": {
341341
"processors": [
342342
{

manage-data/toc.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ toc:
101101
- file: ingest/transform-enrich/common-mistakes.md
102102
- file: ingest/transform-enrich/error-handling.md
103103
- file: ingest/transform-enrich/general-tips.md
104-
- file: ingest/transform-enrich/ingest-lag.md
105104
- file: ingest/transform-enrich/logstash-pipelines.md
106105
- file: ingest/transform-enrich/data-enrichment.md
107106
children:

0 commit comments

Comments
 (0)