Class ElasticsearchVersion
- java.lang.Object
-
- org.hibernate.search.backend.elasticsearch.ElasticsearchVersion
-
public class ElasticsearchVersion extends Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ElasticsearchDistributionNamedistribution()intmajor()booleanmatches(ElasticsearchVersion other)OptionalIntmicro()OptionalIntminor()static ElasticsearchVersionof(String distributionAndVersionString)static ElasticsearchVersionof(ElasticsearchDistributionName distribution, String versionString)Optional<String>qualifier()StringtoString()StringversionString()
-
-
-
Method Detail
-
of
public static ElasticsearchVersion of(String distributionAndVersionString)
- Parameters:
distributionAndVersionString- A version string following the formatx.y.z-qualifieror<distribution>:x.y.z-qualifier, where<distribution>is a string accepted byElasticsearchDistributionName.of(String),x,yandzare integers andqualifieris a string of word characters (alphanumeric or '_'). Incomplete versions are allowed, for example 'elastic:7.0',7.0or just7.- Returns:
- An
ElasticsearchVersionobject 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 formatx.y.z-qualifier, wherex,yandzare integers andqualifieris a string of word characters (alphanumeric or '_'). Incomplete versions are allowed, for example7.0or just7.- Returns:
- An
ElasticsearchVersionobject representing the given version. - Throws:
SearchException- If the input string doesn't follow the required format.
-
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.ELASTICorElasticsearchDistributionName.OPENSEARCH.
-
major
public int major()
- Returns:
- The "major" number of this version, i.e. the
xinx.y.z-qualifier.
-
minor
public OptionalInt minor()
- Returns:
- The "minor" number of this version, i.e. the
yinx.y.z-qualifier. May be empty.
-
micro
public OptionalInt micro()
- Returns:
- The "minor" number of this version, i.e. the
zinx.y.z-qualifier. May be empty.
-
qualifier
public Optional<String> qualifier()
- Returns:
- The qualifier in this version, i.e. the
qualifierinx.y.z-qualifier. May be empty.
-
matches
public boolean matches(ElasticsearchVersion other)
- Parameters:
other- A version to be matched against this version.- Returns:
trueif 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.falseotherwise. Components that are not defined in this version do not matter.
-
-