From 858d05800fc5589b110711ac0b467652be98d3ad Mon Sep 17 00:00:00 2001 From: Przemko Robakowski Date: Tue, 4 May 2021 18:23:23 +0200 Subject: [PATCH 1/9] Disable geoip downloader --- modules/ingest-geoip/build.gradle | 1 + .../geoip/GeoIpDownloaderTaskExecutor.java | 2 +- .../ingest/geoip/IngestGeoIpPlugin.java | 17 ++++++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/modules/ingest-geoip/build.gradle b/modules/ingest-geoip/build.gradle index bf6e9a0d0a226..a5a303da1d3d4 100644 --- a/modules/ingest-geoip/build.gradle +++ b/modules/ingest-geoip/build.gradle @@ -55,6 +55,7 @@ tasks.named("internalClusterTest").configure { if (useFixture) { nonInputProperties.systemProperty "geoip_endpoint", "${-> fixtureAddress()}" } + systemProperty "ingest.geoip.downloader.enabled.default", "true" } tasks.register("copyDefaultGeoIp2DatabaseFiles", Copy) { diff --git a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpDownloaderTaskExecutor.java b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpDownloaderTaskExecutor.java index a2dc5804f566c..c6a1c3a87e606 100644 --- a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpDownloaderTaskExecutor.java +++ b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpDownloaderTaskExecutor.java @@ -37,7 +37,7 @@ */ public final class GeoIpDownloaderTaskExecutor extends PersistentTasksExecutor implements ClusterStateListener { - private static final boolean ENABLED_DEFAULT = "false".equals(System.getProperty("ingest.geoip.downloader.enabled.default")) == false; + static final boolean ENABLED_DEFAULT = "true".equals(System.getProperty("ingest.geoip.downloader.enabled.default")); public static final Setting ENABLED_SETTING = Setting.boolSetting("ingest.geoip.downloader.enabled", ENABLED_DEFAULT, Setting.Property.Dynamic, Setting.Property.NodeScope); diff --git a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java index 5a97678599634..1b351270f694d 100644 --- a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java +++ b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java @@ -113,6 +113,10 @@ public Collection createComponents(Client client, throw new UncheckedIOException(e); } + if(GeoIpDownloaderTaskExecutor.ENABLED_DEFAULT == false){ + return List.of(databaseRegistry.get()); + } + geoIpDownloaderTaskExecutor = new GeoIpDownloaderTaskExecutor(client, new HttpClient(), clusterService, threadPool); return List.of(databaseRegistry.get(), geoIpDownloaderTaskExecutor); } @@ -126,11 +130,17 @@ public void close() throws IOException { public List> getPersistentTasksExecutor(ClusterService clusterService, ThreadPool threadPool, Client client, SettingsModule settingsModule, IndexNameExpressionResolver expressionResolver) { + if (GeoIpDownloaderTaskExecutor.ENABLED_DEFAULT == false) { + return Collections.emptyList(); + } return List.of(geoIpDownloaderTaskExecutor); } @Override public List> getActions() { + if (GeoIpDownloaderTaskExecutor.ENABLED_DEFAULT == false) { + return Collections.emptyList(); + } return List.of(new ActionHandler<>(GeoIpDownloaderStatsAction.INSTANCE, GeoIpDownloaderStatsTransportAction.class)); } @@ -139,6 +149,9 @@ public List getRestHandlers(Settings settings, RestController restC IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier nodesInCluster) { + if (GeoIpDownloaderTaskExecutor.ENABLED_DEFAULT == false) { + return Collections.emptyList(); + } return List.of(new RestGeoIpDownloaderStatsAction()); } @@ -158,6 +171,9 @@ public List getNamedWriteables() { @Override public Collection getSystemIndexDescriptors(Settings settings) { + if (GeoIpDownloaderTaskExecutor.ENABLED_DEFAULT == false) { + return Collections.emptyList(); + } SystemIndexDescriptor geoipDatabasesIndex = SystemIndexDescriptor.builder() .setIndexPattern(DATABASES_INDEX) .setDescription("GeoIP databases") @@ -166,7 +182,6 @@ public Collection getSystemIndexDescriptors(Settings sett .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) .put(IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS, "0-1") - .put(IndexMetadata.SETTING_INDEX_HIDDEN, true) .build()) .setOrigin("geoip") .setVersionMetaKey("version") From 293a9fede1a6fb98fe7c9d9becdd3e91d22d6d93 Mon Sep 17 00:00:00 2001 From: Przemko Robakowski Date: Tue, 4 May 2021 19:28:11 +0200 Subject: [PATCH 2/9] docs --- .../ingest/processors/geoip.asciidoc | 124 ++---------------- 1 file changed, 13 insertions(+), 111 deletions(-) diff --git a/docs/reference/ingest/processors/geoip.asciidoc b/docs/reference/ingest/processors/geoip.asciidoc index 5072f29141f58..454c3ec2bbc35 100644 --- a/docs/reference/ingest/processors/geoip.asciidoc +++ b/docs/reference/ingest/processors/geoip.asciidoc @@ -4,20 +4,20 @@ GeoIP ++++ -The `geoip` processor adds information about the geographical location of an -IPv4 or IPv6 address. +The `geoip` processor adds information about the geographical location of IP addresses, based on data from the Maxmind databases. +This processor adds this information by default under the `geoip` field. The `geoip` processor can resolve both IPv4 and +IPv6 addresses. -[[geoip-automatic-updates]] -By default, the processor uses the GeoLite2 City, GeoLite2 Country, and GeoLite2 -ASN GeoIP2 databases from -http://dev.maxmind.com/geoip/geoip2/geolite2/[MaxMind], shared under the -CCA-ShareAlike 4.0 license. {es} automatically downloads updates for -these databases from the Elastic GeoIP endpoint: -https://geoip.elastic.co/v1/database. To get download statistics for these -updates, use the <>. +The `ingest-geoip` module ships by default with the GeoLite2 City, GeoLite2 Country and GeoLite2 ASN GeoIP2 databases from Maxmind made available +under the CCA-ShareAlike 4.0 license. For more details see, http://dev.maxmind.com/geoip/geoip2/geolite2/ -If your cluster can't connect to the Elastic GeoIP endpoint or you want to -manage your own updates, see <>. +The `geoip` processor can run with other city, country and ASN GeoIP2 databases +from Maxmind. The database files must be copied into the `ingest-geoip` config +directory located at `$ES_CONFIG/ingest-geoip`. Custom database files must be +stored uncompressed and the extension must be `-City.mmdb`, `-Country.mmdb`, or +`-ASN.mmdb` to indicate the type of the database. The +`database_file` processor option is used to specify the filename of the custom +database to use for the processor. [[using-ingest-geoip]] ==== Using the `geoip` Processor in a Pipeline @@ -28,7 +28,7 @@ manage your own updates, see <>. |====== | Name | Required | Default | Description | `field` | yes | - | The field to get the ip address from for the geographical lookup. -| `target_field` | no | geoip | The field that will hold the geographical information looked up from the MaxMind database. +| `target_field` | no | geoip | The field that will hold the geographical information looked up from the Maxmind database. | `database_file` | no | GeoLite2-City.mmdb | The database filename referring to a database the module ships with (GeoLite2-City.mmdb, GeoLite2-Country.mmdb, or GeoLite2-ASN.mmdb) or a custom database in the `ingest-geoip` config directory. | `properties` | no | [`continent_name`, `country_iso_code`, `country_name`, `region_iso_code`, `region_name`, `city_name`, `location`] * | Controls what properties are added to the `target_field` based on the geoip lookup. | `ignore_missing` | no | `false` | If `true` and `field` does not exist, the processor quietly exits without modifying the document @@ -299,79 +299,6 @@ GET /my_ip_locations/_search // TESTRESPONSE[s/"took" : 3/"took" : $body.took/] //// -[[manage-geoip-database-updates]] -==== Manage your own GeoIP2 database updates - -If you can't <> your GeoIP2 -databases from the Elastic endpoint, you have a few other options: - -* <> -* <> -* <> - -[[use-proxy-geoip-endpoint]] -**Use a proxy endpoint** - -If you can't connect directly to the Elastic GeoIP endpoint, consider setting up -a secure proxy. You can then specify the proxy endpoint URL in the -<> setting -of each node’s `elasticsearch.yml` file. - -[[use-custom-geoip-endpoint]] -**Use a custom endpoint** - -You can create a service that mimics the Elastic GeoIP endpoint. You can then -get automatic updates from this service. - -. Download your `.mmdb` database files from the -http://dev.maxmind.com/geoip/geoip2/geolite2[MaxMind site]. - -. Copy your database files to a single directory. - -. From your {es} directory, run: -+ -[source,sh] ----- -./bin/elasticsearch-geoip -s my/source/dir [-t target/directory] ----- - -. Serve the static database files from your directory. For example, you can use -Docker to serve the files from an nginx server: -+ -[source,sh] ----- -docker run -v my/source/dir:/usr/share/nginx/html:ro nginx ----- - -. Specify the service's endpoint URL in the -<> setting -of each node’s `elasticsearch.yml` file. -+ -By default, {es} checks the endpoint for updates every three days. To use -another polling interval, use the <> to set -<>. - -[[manually-update-geoip-databases]] -**Manually update your GeoIP2 databases** - -. Use the <> to set -`ingest.geoip.downloader.enabled` to `false`. This disables automatic updates -that may overwrite your database changes. This also deletes all downloaded -databases. - -. Download your `.mmdb` database files from the -http://dev.maxmind.com/geoip/geoip2/geolite2[MaxMind site]. -+ -You can also use custom city, country, and ASN `.mmdb` files. These files must -be uncompressed and use the respective `-City.mmdb`, `-Country.mmdb`, or -`-ASN.mmdb` extensions. - -. Copy the database files to `$ES_CONFIG/ingest-geoip`. - -. In your `geoip` processors, configure the `database_file` parameter to use a -custom database file. - [[ingest-geoip-settings]] ===== Node Settings @@ -382,28 +309,3 @@ The `geoip` processor supports the following setting: The maximum number of results that should be cached. Defaults to `1000`. Note that these settings are node settings and apply to all `geoip` processors, i.e. there is one cache for all defined `geoip` processors. - -[[geoip-cluster-settings]] -===== Cluster settings - -[[ingest-geoip-downloader-enabled]] -`ingest.geoip.downloader.enabled`:: -(<>, Boolean) -If `true`, {es} automatically downloads and manages updates for GeoIP2 databases -from the `ingest.geoip.downloader.endpoint`. If `false`, {es} does not download -updates and deletes all downloaded databases. Defaults to `true`. - -[[ingest-geoip-downloader-endpoint]] -`ingest.geoip.downloader.endpoint`:: -(<>, string) -Endpoint URL used to download updates for GeoIP2 databases. Defaults to -`https://geoip.elastic.co/v1/database`. {es} stores downloaded database files in -each node's <> at -`$ES_TMPDIR/geoip-databases/`. - -[[ingest-geoip-downloader-poll-interval]] -`ingest.geoip.downloader.poll.interval`:: -(<>, <>) -How often {es} checks for GeoIP2 database updates at the -`ingest.geoip.downloader.endpoint`. Must be greater than `1d` (one day). Defaults -to `3d` (three days). From ba753d74c6b8f7dfbcce022e26ed68e4325ec4dc Mon Sep 17 00:00:00 2001 From: Przemko Robakowski Date: Tue, 4 May 2021 20:02:48 +0200 Subject: [PATCH 3/9] actions --- .../java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java index 1b351270f694d..a4f877cc2a51e 100644 --- a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java +++ b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java @@ -138,9 +138,6 @@ public List> getPersistentTasksExecutor(ClusterServic @Override public List> getActions() { - if (GeoIpDownloaderTaskExecutor.ENABLED_DEFAULT == false) { - return Collections.emptyList(); - } return List.of(new ActionHandler<>(GeoIpDownloaderStatsAction.INSTANCE, GeoIpDownloaderStatsTransportAction.class)); } From 71a78de7148ab6007ab329e73b72e056d7959519 Mon Sep 17 00:00:00 2001 From: Przemko Robakowski Date: Tue, 4 May 2021 20:16:45 +0200 Subject: [PATCH 4/9] actions --- .../java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java index a4f877cc2a51e..1b351270f694d 100644 --- a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java +++ b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java @@ -138,6 +138,9 @@ public List> getPersistentTasksExecutor(ClusterServic @Override public List> getActions() { + if (GeoIpDownloaderTaskExecutor.ENABLED_DEFAULT == false) { + return Collections.emptyList(); + } return List.of(new ActionHandler<>(GeoIpDownloaderStatsAction.INSTANCE, GeoIpDownloaderStatsTransportAction.class)); } From 901181179cfb9cfa7dae20775c8a56449e5a969e Mon Sep 17 00:00:00 2001 From: Przemko Robakowski Date: Tue, 4 May 2021 20:18:09 +0200 Subject: [PATCH 5/9] docs/specs --- .../ingest/apis/geoip-stats-api.asciidoc | 93 ------------------- docs/reference/ingest/apis/index.asciidoc | 1 - .../test/ingest_geoip/30_geoip_stats.yml | 10 -- .../api/ingest.geo_ip_stats.json | 25 ----- 4 files changed, 129 deletions(-) delete mode 100644 docs/reference/ingest/apis/geoip-stats-api.asciidoc delete mode 100644 modules/ingest-geoip/src/yamlRestTest/resources/rest-api-spec/test/ingest_geoip/30_geoip_stats.yml delete mode 100644 rest-api-spec/src/main/resources/rest-api-spec/api/ingest.geo_ip_stats.json diff --git a/docs/reference/ingest/apis/geoip-stats-api.asciidoc b/docs/reference/ingest/apis/geoip-stats-api.asciidoc deleted file mode 100644 index 6ef0db546342b..0000000000000 --- a/docs/reference/ingest/apis/geoip-stats-api.asciidoc +++ /dev/null @@ -1,93 +0,0 @@ -[[geoip-stats-api]] -=== GeoIP stats API -++++ -GeoIP stats -++++ - -Gets download statistics for GeoIP2 databases used with the -<>. - -[source,console] ----- -GET _ingest/geoip/stats ----- - -[[geoip-stats-api-request]] -==== {api-request-title} - -`GET _ingest/geoip/stats` - -[[geoip-stats-api-prereqs]] -==== {api-prereq-title} - -* If the {es} {security-features} are enabled, you must have the `monitor` or -`manage` <> to use this API. - -* If <> is -disabled, this API returns zero values and an empty `nodes` object. - -[role="child_attributes"] -[[geoip-stats-api-response-body]] -==== {api-response-body-title} - -`stats`:: -(object) -Download statistics for all GeoIP2 databases. -+ -.Properties of `stats` -[%collapsible%open] -==== -`successful_downloads`:: -(integer) -Total number of successful database downloads. - -`failed_downloads`:: -(integer) -Total number of failed database downloads. - -`total_download_time`:: -(integer) -Total milliseconds spent downloading databases. - -`database_count`:: -(integer) -Current number of databases available for use. - -`skipped_updates`:: -(integer) -Total number of database updates skipped. -==== - -`nodes`:: -(object) -Downloaded GeoIP2 databases for each node. -+ -.Properties of `nodes` -[%collapsible%open] -==== -``:: -(object) -Downloaded databases for the node. The field key is the node ID. -+ -.Properties of `` -[%collapsible%open] -===== -`databases`:: -(array of objects) -Downloaded databases for the node. -+ -.Properties of `databases` objects -[%collapsible%open] -====== -`name`:: -(string) -Name of the database. -====== - -`files_in_temp`:: -(array of strings) -Downloaded database files, including related license files. {es} stores these -files in the node's <>: -`$ES_TMPDIR/geoip-databases/`. -===== -==== \ No newline at end of file diff --git a/docs/reference/ingest/apis/index.asciidoc b/docs/reference/ingest/apis/index.asciidoc index 090a39e3834a5..874f59c712bfb 100644 --- a/docs/reference/ingest/apis/index.asciidoc +++ b/docs/reference/ingest/apis/index.asciidoc @@ -25,5 +25,4 @@ the <>. include::put-pipeline.asciidoc[] include::delete-pipeline.asciidoc[] include::get-pipeline.asciidoc[] -include::geoip-stats-api.asciidoc[] include::simulate-pipeline.asciidoc[] diff --git a/modules/ingest-geoip/src/yamlRestTest/resources/rest-api-spec/test/ingest_geoip/30_geoip_stats.yml b/modules/ingest-geoip/src/yamlRestTest/resources/rest-api-spec/test/ingest_geoip/30_geoip_stats.yml deleted file mode 100644 index 852b2047a47ec..0000000000000 --- a/modules/ingest-geoip/src/yamlRestTest/resources/rest-api-spec/test/ingest_geoip/30_geoip_stats.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -"Test geoip stats": - - do: - ingest.geo_ip_stats: {} - - gte: { stats.successful_downloads: 0 } - - gte: { stats.failed_downloads: 0 } - - gte: { stats.skipped_updates: 0 } - - gte: { stats.databases_count: 0 } - - gte: { stats.total_download_time: 0 } - - is_true: nodes diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/ingest.geo_ip_stats.json b/rest-api-spec/src/main/resources/rest-api-spec/api/ingest.geo_ip_stats.json deleted file mode 100644 index 1013d7dc6fc5e..0000000000000 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/ingest.geo_ip_stats.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "ingest.geo_ip_stats": { - "documentation": { - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/geoip-stats-api.html", - "description": "Returns statistical information about geoip databases" - }, - "stability": "stable", - "visibility": "public", - "headers": { - "accept": [ - "application/json" - ] - }, - "url": { - "paths": [ - { - "path": "/_ingest/geoip/stats", - "methods": [ - "GET" - ] - } - ] - } - } -} From 0d981164d53c40a7ebf642f04ecfb4f1b6abb81b Mon Sep 17 00:00:00 2001 From: Przemko Robakowski Date: Tue, 4 May 2021 23:32:05 +0200 Subject: [PATCH 6/9] Revert "docs/specs" This reverts commit 90118117 --- .../ingest/apis/geoip-stats-api.asciidoc | 93 +++++++++++++++++++ docs/reference/ingest/apis/index.asciidoc | 1 + .../test/ingest_geoip/30_geoip_stats.yml | 10 ++ .../api/ingest.geo_ip_stats.json | 25 +++++ 4 files changed, 129 insertions(+) create mode 100644 docs/reference/ingest/apis/geoip-stats-api.asciidoc create mode 100644 modules/ingest-geoip/src/yamlRestTest/resources/rest-api-spec/test/ingest_geoip/30_geoip_stats.yml create mode 100644 rest-api-spec/src/main/resources/rest-api-spec/api/ingest.geo_ip_stats.json diff --git a/docs/reference/ingest/apis/geoip-stats-api.asciidoc b/docs/reference/ingest/apis/geoip-stats-api.asciidoc new file mode 100644 index 0000000000000..6ef0db546342b --- /dev/null +++ b/docs/reference/ingest/apis/geoip-stats-api.asciidoc @@ -0,0 +1,93 @@ +[[geoip-stats-api]] +=== GeoIP stats API +++++ +GeoIP stats +++++ + +Gets download statistics for GeoIP2 databases used with the +<>. + +[source,console] +---- +GET _ingest/geoip/stats +---- + +[[geoip-stats-api-request]] +==== {api-request-title} + +`GET _ingest/geoip/stats` + +[[geoip-stats-api-prereqs]] +==== {api-prereq-title} + +* If the {es} {security-features} are enabled, you must have the `monitor` or +`manage` <> to use this API. + +* If <> is +disabled, this API returns zero values and an empty `nodes` object. + +[role="child_attributes"] +[[geoip-stats-api-response-body]] +==== {api-response-body-title} + +`stats`:: +(object) +Download statistics for all GeoIP2 databases. ++ +.Properties of `stats` +[%collapsible%open] +==== +`successful_downloads`:: +(integer) +Total number of successful database downloads. + +`failed_downloads`:: +(integer) +Total number of failed database downloads. + +`total_download_time`:: +(integer) +Total milliseconds spent downloading databases. + +`database_count`:: +(integer) +Current number of databases available for use. + +`skipped_updates`:: +(integer) +Total number of database updates skipped. +==== + +`nodes`:: +(object) +Downloaded GeoIP2 databases for each node. ++ +.Properties of `nodes` +[%collapsible%open] +==== +``:: +(object) +Downloaded databases for the node. The field key is the node ID. ++ +.Properties of `` +[%collapsible%open] +===== +`databases`:: +(array of objects) +Downloaded databases for the node. ++ +.Properties of `databases` objects +[%collapsible%open] +====== +`name`:: +(string) +Name of the database. +====== + +`files_in_temp`:: +(array of strings) +Downloaded database files, including related license files. {es} stores these +files in the node's <>: +`$ES_TMPDIR/geoip-databases/`. +===== +==== \ No newline at end of file diff --git a/docs/reference/ingest/apis/index.asciidoc b/docs/reference/ingest/apis/index.asciidoc index 874f59c712bfb..090a39e3834a5 100644 --- a/docs/reference/ingest/apis/index.asciidoc +++ b/docs/reference/ingest/apis/index.asciidoc @@ -25,4 +25,5 @@ the <>. include::put-pipeline.asciidoc[] include::delete-pipeline.asciidoc[] include::get-pipeline.asciidoc[] +include::geoip-stats-api.asciidoc[] include::simulate-pipeline.asciidoc[] diff --git a/modules/ingest-geoip/src/yamlRestTest/resources/rest-api-spec/test/ingest_geoip/30_geoip_stats.yml b/modules/ingest-geoip/src/yamlRestTest/resources/rest-api-spec/test/ingest_geoip/30_geoip_stats.yml new file mode 100644 index 0000000000000..852b2047a47ec --- /dev/null +++ b/modules/ingest-geoip/src/yamlRestTest/resources/rest-api-spec/test/ingest_geoip/30_geoip_stats.yml @@ -0,0 +1,10 @@ +--- +"Test geoip stats": + - do: + ingest.geo_ip_stats: {} + - gte: { stats.successful_downloads: 0 } + - gte: { stats.failed_downloads: 0 } + - gte: { stats.skipped_updates: 0 } + - gte: { stats.databases_count: 0 } + - gte: { stats.total_download_time: 0 } + - is_true: nodes diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/ingest.geo_ip_stats.json b/rest-api-spec/src/main/resources/rest-api-spec/api/ingest.geo_ip_stats.json new file mode 100644 index 0000000000000..1013d7dc6fc5e --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/ingest.geo_ip_stats.json @@ -0,0 +1,25 @@ +{ + "ingest.geo_ip_stats": { + "documentation": { + "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/geoip-stats-api.html", + "description": "Returns statistical information about geoip databases" + }, + "stability": "stable", + "visibility": "public", + "headers": { + "accept": [ + "application/json" + ] + }, + "url": { + "paths": [ + { + "path": "/_ingest/geoip/stats", + "methods": [ + "GET" + ] + } + ] + } + } +} From a2b022489f87bc4c93f04cb9d85d5c1fd8ec080e Mon Sep 17 00:00:00 2001 From: Przemko Robakowski Date: Wed, 5 May 2021 00:01:33 +0200 Subject: [PATCH 7/9] actions --- .../ingest/geoip/IngestGeoIpPlugin.java | 3 --- .../stats/GeoIpDownloaderStatsTransportAction.java | 13 ++++++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java index 1b351270f694d..a4f877cc2a51e 100644 --- a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java +++ b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java @@ -138,9 +138,6 @@ public List> getPersistentTasksExecutor(ClusterServic @Override public List> getActions() { - if (GeoIpDownloaderTaskExecutor.ENABLED_DEFAULT == false) { - return Collections.emptyList(); - } return List.of(new ActionHandler<>(GeoIpDownloaderStatsAction.INSTANCE, GeoIpDownloaderStatsTransportAction.class)); } diff --git a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/stats/GeoIpDownloaderStatsTransportAction.java b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/stats/GeoIpDownloaderStatsTransportAction.java index 738970729694a..e9ec8290f182e 100644 --- a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/stats/GeoIpDownloaderStatsTransportAction.java +++ b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/stats/GeoIpDownloaderStatsTransportAction.java @@ -33,17 +33,20 @@ public class GeoIpDownloaderStatsTransportAction extends TransportNodesAction Date: Wed, 5 May 2021 00:44:41 +0200 Subject: [PATCH 8/9] actions --- .../java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java index a4f877cc2a51e..f62703f278c70 100644 --- a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java +++ b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/IngestGeoIpPlugin.java @@ -146,9 +146,6 @@ public List getRestHandlers(Settings settings, RestController restC IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver, Supplier nodesInCluster) { - if (GeoIpDownloaderTaskExecutor.ENABLED_DEFAULT == false) { - return Collections.emptyList(); - } return List.of(new RestGeoIpDownloaderStatsAction()); } From 5c22177be43d9d57827d2ee59ae7463db8f7d7d3 Mon Sep 17 00:00:00 2001 From: Przemko Robakowski Date: Wed, 5 May 2021 00:57:15 +0200 Subject: [PATCH 9/9] docs --- docs/reference/ingest/apis/geoip-stats-api.asciidoc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/reference/ingest/apis/geoip-stats-api.asciidoc b/docs/reference/ingest/apis/geoip-stats-api.asciidoc index 6ef0db546342b..dda1f1a2d1492 100644 --- a/docs/reference/ingest/apis/geoip-stats-api.asciidoc +++ b/docs/reference/ingest/apis/geoip-stats-api.asciidoc @@ -23,9 +23,6 @@ GET _ingest/geoip/stats * If the {es} {security-features} are enabled, you must have the `monitor` or `manage` <> to use this API. -* If <> is -disabled, this API returns zero values and an empty `nodes` object. - [role="child_attributes"] [[geoip-stats-api-response-body]] ==== {api-response-body-title} @@ -90,4 +87,4 @@ Downloaded database files, including related license files. {es} stores these files in the node's <>: `$ES_TMPDIR/geoip-databases/`. ===== -==== \ No newline at end of file +====