Package org.elasticsearch
Class Version
java.lang.Object
org.elasticsearch.Version
- All Implemented Interfaces:
java.lang.Comparable<Version>,ToXContent,ToXContentFragment
public class Version extends java.lang.Object implements java.lang.Comparable<Version>, ToXContentFragment
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params -
Field Summary
-
Method Summary
Modifier and Type Method Description booleanafter(Version version)booleanbefore(Version version)intcompareTo(Version other)booleanequals(java.lang.Object o)static VersionfromId(int id)static VersionfromString(java.lang.String version)Returns the version given its string representation, current version if the argument is null or emptystatic java.util.List<Version>getDeclaredVersions(java.lang.Class<?> versionClass)Extracts a sorted list of declared version constants from a class.inthashCode()static VersionindexCreated(Settings indexSettings)Return theVersionof Elasticsearch that has been used to create an index given its settings.booleanisAlpha()Returns true iff this version is an alpha version Note: This has been introduced in elasticsearch version 5.booleanisBeta()booleanisCompatible(Version version)Returnstrueiff both version are compatible.booleanisRC()booleanisRelease()static voidmain(java.lang.String[] args)static Versionmax(Version version1, Version version2)Returns the maximum version between the 2static Versionmin(Version version1, Version version2)Returns the minimum version between the 2.VersionminimumCompatibilityVersion()Returns the minimum compatible version based on the current version.VersionminimumIndexCompatibilityVersion()Returns the minimum created index version that this version supports.booleanonOrAfter(Version version)booleanonOrBefore(Version version)static VersionreadVersion(StreamInput in)java.lang.StringtoString()XContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)static voidwriteVersion(Version version, StreamOutput out)
-
Field Details
-
V_EMPTY_ID
public static final int V_EMPTY_ID- See Also:
- Constant Field Values
-
V_EMPTY
-
V_6_0_0_alpha1
-
V_6_0_0_alpha2
-
V_6_0_0_beta1
-
V_6_0_0_beta2
-
V_6_0_0_rc1
-
V_6_0_0_rc2
-
V_6_0_0
-
V_6_0_1
-
V_6_1_0
-
V_6_1_1
-
V_6_1_2
-
V_6_1_3
-
V_6_1_4
-
V_6_2_0
-
V_6_2_1
-
V_6_2_2
-
V_6_2_3
-
V_6_2_4
-
V_6_3_0
-
V_6_3_1
-
V_6_3_2
-
V_6_4_0
-
V_6_4_1
-
V_6_4_2
-
V_6_4_3
-
V_6_5_0
-
V_6_5_1
-
V_6_5_2
-
V_6_5_3
-
V_6_5_4
-
V_6_6_0
-
V_6_6_1
-
V_6_6_2
-
V_6_7_0
-
V_6_7_1
-
V_6_7_2
-
V_6_8_0
-
V_6_8_1
-
V_6_8_2
-
V_6_8_3
-
V_6_8_4
-
V_6_8_5
-
V_6_8_6
-
V_6_8_7
-
V_6_8_8
-
V_7_0_0
-
V_7_0_1
-
V_7_1_0
-
V_7_1_1
-
V_7_2_0
-
V_7_2_1
-
V_7_3_0
-
V_7_3_1
-
V_7_3_2
-
V_7_4_0
-
V_7_4_1
-
V_7_4_2
-
V_7_5_0
-
V_7_5_1
-
V_7_5_2
-
V_7_6_0
-
V_7_6_1
-
V_7_6_2
-
CURRENT
-
id
public final int id -
major
public final byte major -
minor
public final byte minor -
revision
public final byte revision -
build
public final byte build -
luceneVersion
public final org.apache.lucene.util.Version luceneVersion
-
-
Method Details
-
readVersion
- Throws:
java.io.IOException
-
fromId
-
indexCreated
Return theVersionof Elasticsearch that has been used to create an index given its settings.- Throws:
java.lang.IllegalStateException- if the given index settings doesn't contain a value for the key "index.version.created"
-
writeVersion
- Throws:
java.io.IOException
-
min
Returns the minimum version between the 2. -
max
Returns the maximum version between the 2 -
fromString
Returns the version given its string representation, current version if the argument is null or empty -
after
-
onOrAfter
-
before
-
onOrBefore
-
compareTo
- Specified by:
compareToin interfacejava.lang.Comparable<Version>
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceToXContent- Throws:
java.io.IOException
-
minimumCompatibilityVersion
Returns the minimum compatible version based on the current version. Ie a node needs to have at least the return version in order to communicate with a node running the current version. The returned version is in most of the cases the smallest major version release unless the current version is a beta or RC release then the version itself is returned. -
minimumIndexCompatibilityVersion
Returns the minimum created index version that this version supports. Indices created with lower versions can't be used with this version. This should also be used for file based serialization backwards compatibility ie. on serialization code that is used to read / write file formats like transaction logs, cluster state, and index metadata. -
isCompatible
Returnstrueiff both version are compatible. Otherwisefalse -
main
public static void main(java.lang.String[] args) -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
isBeta
public boolean isBeta() -
isAlpha
public boolean isAlpha()Returns true iff this version is an alpha version Note: This has been introduced in elasticsearch version 5. Previous versions will never have an alpha version. -
isRC
public boolean isRC() -
isRelease
public boolean isRelease() -
getDeclaredVersions
Extracts a sorted list of declared version constants from a class. The argument would normally be Version.class but is exposed for testing with other classes-containing-version-constants.
-