add simple way to get the index creation version when building a mapper

This commit is contained in:
Shay Banon 2013-01-03 19:06:03 +01:00
parent 9f60dc7578
commit 0032b334c5
1 changed files with 10 additions and 0 deletions

View File

@ -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<T extends Builder, Y extends Mapper> {