Class Version

    • Method Detail

      • readVersion

        public static Version readVersion​(StreamInput in)
      • fromId

        public static Version fromId​(int id)
      • indexCreated

        public static Version indexCreated​(Settings indexSettings)
        Return the Version of Elasticsearch that has been used to create an index given its settings.
        java.lang.IllegalStateException - if the given index settings doesn't contain a value for the key "index.version.created"
      • writeVersion

        public static void writeVersion​(Version version,
                                        StreamOutput out)
      • min

        public static Version min​(Version version1,
                                  Version version2)
        Returns the minimum version between the 2.
      • max

        public static Version max​(Version version1,
                                  Version version2)
        Returns the maximum version between the 2
      • fromString

        public static Version fromString​(java.lang.String version)
        Returns the version given its string representation, current version if the argument is null or empty
      • after

        public boolean after​(Version version)
      • onOrAfter

        public boolean onOrAfter​(Version version)
      • before

        public boolean before​(Version version)
      • onOrBefore

        public boolean onOrBefore​(Version version)
      • compareTo

        public int compareTo​(Version other)
        Specified by:
        compareTo in interface java.lang.Comparable<Version>
      • minimumCompatibilityVersion

        public Version 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

        public Version 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

        public boolean isCompatible​(Version version)
        Returns true iff both version are compatible. Otherwise false
      • main

        public static void main​(java.lang.String[] args)
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
      • displayVersion

        public static java.lang.String displayVersion​(Version version,
                                                      boolean isSnapshot)
      • equals

        public boolean equals​(java.lang.Object o)
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        hashCode in class java.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

        public static java.util.List<Version> getDeclaredVersions​(java.lang.Class<?> versionClass)
        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.