elastic / elastic/logstash

Event API: add Map.compute-like methods

Open
#8,306 0 comments 0 reactions 0 assignees View on GitHub
v6.1.0
Dominant language
Java
Stars
14.9k
Forks
3.5k
Avg merge
19h 14m
Merged PRs (30d)
63

Description

Add Map-like `compute`, `computeIfAbsent`, and `computeIfPresent`:

Two flavors are possible:

* source + target: `Event.compute(FieldReference source, FieldReference target, Function compute)`
* modify the field: `Event.compute(FieldReference field, Function compute)`

Mostly the positive impact is believed (per discussion with a few folks) to be around the mutate filter and script/ruby filters. For this reason, the `modify the field` option is probably a good target since we want to enable functionality with less typing for script/ruby filter users.

Proposal:

```
void compute(FieldReference, field, Function compute) throws FieldMissingException;

// most valuable, probably, for script/ruby filter users
void computeIfPresent(FieldReference, field, Function compute) throws FieldMissingException;

void computeIfAbsent(FieldReference, field, Function compute) throws FieldMissingException;
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.