Skip to content

Commit

Permalink
Removing Version.CURRENT from geo ip (elastic#102108)
Browse files Browse the repository at this point in the history
  • Loading branch information
masseyke authored Nov 14, 2023
1 parent 9a50817 commit 59b730d
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
package org.elasticsearch.ingest.geoip;

import org.apache.lucene.util.SetOnce;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.client.internal.Client;
Expand Down Expand Up @@ -65,6 +64,14 @@
public class IngestGeoIpPlugin extends Plugin implements IngestPlugin, SystemIndexPlugin, Closeable, PersistentTaskPlugin, ActionPlugin {
public static final Setting<Long> CACHE_SIZE = Setting.longSetting("ingest.geoip.cache_size", 1000, 0, Setting.Property.NodeScope);
private static final int GEOIP_INDEX_MAPPINGS_VERSION = 1;
/**
* No longer used for determining the age of mappings, but system index descriptor
* code requires <em>something</em> be set. We use a value that can be parsed by
* old nodes in mixed-version clusters, just in case any old code exists that
* tries to parse <code>version</code> from index metadata, and that will indicate
* to these old nodes that the mappings are newer than they are.
*/
private static final String LEGACY_VERSION_FIELD_VALUE = "8.12.0";

private final SetOnce<IngestService> ingestService = new SetOnce<>();
private final SetOnce<DatabaseNodeService> databaseRegistry = new SetOnce<>();
Expand Down Expand Up @@ -204,7 +211,7 @@ private static XContentBuilder mappings() {
return jsonBuilder().startObject()
.startObject(SINGLE_MAPPING_NAME)
.startObject("_meta")
.field("version", Version.CURRENT)
.field("version", LEGACY_VERSION_FIELD_VALUE)
.field(SystemIndexDescriptor.VERSION_META_KEY, GEOIP_INDEX_MAPPINGS_VERSION)
.endObject()
.field("dynamic", "strict")
Expand Down

0 comments on commit 59b730d

Please sign in to comment.