This class allows us to check whether an Elasticsearch release
is "too old" or "too new," using an intentionally minimal API for
comparisons. The static current()
method returns the current
release version, and fromVersionId(int)
returns a version
based on some identifier. By default, this identifier matches what the
Version
class uses, but the implementation is pluggable.
If a module provides a BuildExtension
service via Java SPI, this
class's static methods will return a different implementation of BuildVersion
,
potentially with different behavior. This allows downstream projects to
provide versions that accommodate different release models or versioning
schemes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BuildVersion
current()
Get the current build version.static BuildVersion
fromVersionId
(int versionId) Create aBuildVersion
from a version ID number.abstract int
id()
abstract boolean
Check whether this version comes from a release later than the currently running Elasticsearch.abstract boolean
Check whether this version is on or after a minimum threshold.Deprecated.
-
Constructor Details
-
BuildVersion
public BuildVersion()
-
-
Method Details
-
onOrAfterMinimumCompatible
public abstract boolean onOrAfterMinimumCompatible()Check whether this version is on or after a minimum threshold.In some cases, the only thing we need to know about a version is whether it's compatible with the currently-running Elasticsearch. This method checks the lower bound, and returns false if the version is "too old."
By default, the minimum compatible version is derived from
Version.CURRENT.minimumCompatibilityVersion()
, but this behavior is pluggable.- Returns:
- True if this version is on or after the minimum compatible version for the currently running Elasticsearch, false otherwise.
-
isFutureVersion
public abstract boolean isFutureVersion()Check whether this version comes from a release later than the currently running Elasticsearch.This is useful for checking whether a node would be downgraded.
- Returns:
- True if this version represents a release of Elasticsearch later than the one that's running.
-
toVersion
Deprecated. -
fromVersionId
Create aBuildVersion
from a version ID number.By default, this identifier should match the integer ID of a
Version
; see that class for details on the default semantic versioning scheme. This behavior is, of course, pluggable.- Parameters:
versionId
- An integer identifier for a version- Returns:
- a version representing a build or release of Elasticsearch
-
current
Get the current build version.By default, this value will be different for every public release of Elasticsearch, but downstream implementations aren't restricted by this condition.
- Returns:
- The BuildVersion for Elasticsearch
-
id
public abstract int id()
-