From 3cf99cf83fc7d10bc7f1b42ee8a59fae1480391b Mon Sep 17 00:00:00 2001 From: Alexander Reelsen Date: Mon, 16 Sep 2019 11:29:59 +0200 Subject: [PATCH] Expose cache setting in UserAgentPlugin (#46533) The setting was not registered. Also documentation has been added. --- docs/reference/ingest/processors/user-agent.asciidoc | 11 +++++++++++ .../ingest/useragent/IngestUserAgentPlugin.java | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/docs/reference/ingest/processors/user-agent.asciidoc b/docs/reference/ingest/processors/user-agent.asciidoc index 67dc76c478ea7..f977c98563142 100644 --- a/docs/reference/ingest/processors/user-agent.asciidoc +++ b/docs/reference/ingest/processors/user-agent.asciidoc @@ -84,3 +84,14 @@ In practice, it will make most sense for any custom regex file to be a variant o or a customised version. 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 + +[[ingest-user-agent-settings]] +===== Node Settings + +The `user_agent` processor supports the following setting: + +`ingest.user_agent.cache_size`:: + + The maximum number of results that should be cached. Defaults to `1000`. + +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. diff --git a/modules/ingest-user-agent/src/main/java/org/elasticsearch/ingest/useragent/IngestUserAgentPlugin.java b/modules/ingest-user-agent/src/main/java/org/elasticsearch/ingest/useragent/IngestUserAgentPlugin.java index 899b3eb721c3d..e0bd7b7207aae 100644 --- a/modules/ingest-user-agent/src/main/java/org/elasticsearch/ingest/useragent/IngestUserAgentPlugin.java +++ b/modules/ingest-user-agent/src/main/java/org/elasticsearch/ingest/useragent/IngestUserAgentPlugin.java @@ -32,6 +32,7 @@ import java.nio.file.StandardOpenOption; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.stream.Stream; @@ -86,4 +87,8 @@ static Map createUserAgentParsers(Path userAgentConfigD return Collections.unmodifiableMap(userAgentParsers); } + @Override + public List> getSettings() { + return Collections.singletonList(CACHE_SIZE_SETTING); + } }