From 0032b334c5ac34caf7cb8c1ac7277ec0f6cf07f4 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Thu, 3 Jan 2013 19:06:03 +0100 Subject: [PATCH] add simple way to get the index creation version when building a mapper --- .../java/org/elasticsearch/index/mapper/Mapper.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/org/elasticsearch/index/mapper/Mapper.java b/src/main/java/org/elasticsearch/index/mapper/Mapper.java index a29542966cd..74d68341ae9 100644 --- a/src/main/java/org/elasticsearch/index/mapper/Mapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/Mapper.java @@ -20,6 +20,8 @@ package org.elasticsearch.index.mapper; import com.google.common.collect.ImmutableMap; +import org.elasticsearch.Version; +import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; @@ -55,6 +57,14 @@ public interface Mapper extends ToXContent { public Settings indexSettings() { return this.indexSettings; } + + @Nullable + public Version indexCreatedVersion() { + if (indexSettings == null) { + return null; + } + return indexSettings.getAsVersion(IndexMetaData.SETTING_VERSION_CREATED, null); + } } public static abstract class Builder {