Class ElasticsearchVersion

java.lang.Object
org.hibernate.search.backend.elasticsearch.ElasticsearchVersion

public class ElasticsearchVersion extends Object
  • Method Details

    • of

      public static ElasticsearchVersion of(String distributionAndVersionString)
      Parameters:
      distributionAndVersionString - A version string following the format x.y.z-qualifier or <distribution>:x.y.z-qualifier, where <distribution> is a string accepted by ElasticsearchDistributionName.of(String), x, y and z are integers and qualifier is a string of word characters (alphanumeric or '_'). Incomplete versions are allowed, for example 'elastic:7.0', 7.0 or just 7.
      Returns:
      An ElasticsearchVersion object representing the given version.
      Throws:
      SearchException - If the input string doesn't follow the required format.
    • of

      public static ElasticsearchVersion of(ElasticsearchDistributionName distribution, String versionString)
      Parameters:
      distribution - A distribution name.
      versionString - A version string following the format x.y.z-qualifier, where x, y and z are integers and qualifier is a string of word characters (alphanumeric or '_'). Incomplete versions are allowed, for example 7.0 or just 7. Null is allowed.
      Returns:
      An ElasticsearchVersion object representing the given version.
      Throws:
      SearchException - If the input string doesn't follow the required format.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • versionString

      public String versionString()
      Returns:
      The version string, i.e. the version without the distribution prefix.
    • distribution

      public ElasticsearchDistributionName distribution()
      Returns:
      The distribution to which this version applies, e.g. ElasticsearchDistributionName.ELASTIC or ElasticsearchDistributionName.OPENSEARCH.
    • major

      @Deprecated public int major()
      Deprecated.
      Use majorOptional() instead.
      Returns:
      The "major" number of this version, i.e. the x in x.y.z-qualifier.
    • majorOptional

      public OptionalInt majorOptional()
      Returns:
      The "major" number of this version, i.e. the x in x.y.z-qualifier. May be empty.
    • minor

      public OptionalInt minor()
      Returns:
      The "minor" number of this version, i.e. the y in x.y.z-qualifier. May be empty.
    • micro

      public OptionalInt micro()
      Returns:
      The "minor" number of this version, i.e. the z in x.y.z-qualifier. May be empty.
    • qualifier

      public Optional<String> qualifier()
      Returns:
      The qualifier in this version, i.e. the qualifier in x.y.z-qualifier. May be empty.
    • matches

      public boolean matches(ElasticsearchVersion other)
      Parameters:
      other - A version to be matched against this version.
      Returns:
      true if the other version matches this version, i.e. if all the components defined in this version are also defined in the other version with the same value. false otherwise. Components that are not defined in this version do not matter.