Skip to content

Commit 3cf99cf

Browse files
authored
Expose cache setting in UserAgentPlugin (#46533)
The setting was not registered. Also documentation has been added.
1 parent 3aa417e commit 3cf99cf

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

docs/reference/ingest/processors/user-agent.asciidoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,14 @@ In practice, it will make most sense for any custom regex file to be a variant o
8484
or a customised version.
8585

8686
The default file included in `ingest-user-agent` is the `regexes.yaml` from uap-core: https://github.com/ua-parser/uap-core/blob/master/regexes.yaml
87+
88+
[[ingest-user-agent-settings]]
89+
===== Node Settings
90+
91+
The `user_agent` processor supports the following setting:
92+
93+
`ingest.user_agent.cache_size`::
94+
95+
The maximum number of results that should be cached. Defaults to `1000`.
96+
97+
Note that these settings are node settings and apply to all `user_agent` processors, i.e. there is one cache for all defined `user_agent` processors.

modules/ingest-user-agent/src/main/java/org/elasticsearch/ingest/useragent/IngestUserAgentPlugin.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import java.nio.file.StandardOpenOption;
3333
import java.util.Collections;
3434
import java.util.HashMap;
35+
import java.util.List;
3536
import java.util.Map;
3637
import java.util.stream.Stream;
3738

@@ -86,4 +87,8 @@ static Map<String, UserAgentParser> createUserAgentParsers(Path userAgentConfigD
8687
return Collections.unmodifiableMap(userAgentParsers);
8788
}
8889

90+
@Override
91+
public List<Setting<?>> getSettings() {
92+
return Collections.singletonList(CACHE_SIZE_SETTING);
93+
}
8994
}

0 commit comments

Comments
 (0)