add simple way to get the index creation version when building a mapper
This commit is contained in:
parent
9f60dc7578
commit
0032b334c5
|
@ -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> {
|
||||
|
|
Loading…
Reference in New Issue