- All Implemented Interfaces:
- Writeable,- ToXContent,- ToXContentFragment
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.
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContentToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.WriteableWriteable.Reader<V>, Writeable.Writer<V>
- 
Field SummaryFields inherited from interface org.elasticsearch.xcontent.ToXContentEMPTY, EMPTY_PARAMS
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract booleanChecks if this version can operate properly in a cluster without features that are assumed in the currently running Elasticsearch.static BuildVersioncurrent()Get the current build version.static BuildVersionfromNodeMetadata(String version) Create aBuildVersionfrom a version in node metadatastatic BuildVersionfromStream(StreamInput input) Read aBuildVersionfrom an input streamstatic BuildVersionfromString(String version) Create aBuildVersionfrom a version string.static BuildVersionfromVersionId(int versionId) Create aBuildVersionfrom a version ID number.abstract booleanCheck whether this version comes from a release later than the currently running Elasticsearch.abstract BuildVersionReturns the minimum compatible build version based on the current version.abstract booleanCheck whether this version is on or after a minimum threshold.abstract StringReturns this build version in a form suitable for storing in node metadataMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContenttoXContentMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragmentisFragment
- 
Constructor Details- 
BuildVersionpublic BuildVersion()
 
- 
- 
Method Details- 
canRemoveAssumedFeaturespublic abstract boolean canRemoveAssumedFeatures()Checks if this version can operate properly in a cluster without features that are assumed in the currently running Elasticsearch.
- 
onOrAfterMinimumCompatiblepublic 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.
 
- 
isFutureVersionpublic 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.
 
- 
toNodeMetadataReturns this build version in a form suitable for storing in node metadata
- 
minimumCompatibilityVersionReturns the minimum compatible build 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.
- 
fromVersionIdCreate aBuildVersionfrom 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
 
- 
fromNodeMetadataCreate aBuildVersionfrom a version in node metadata- Parameters:
- version- The string stored in node metadata
- Returns:
- a version representing a build or release of Elasticsearch
 
- 
fromStringCreate aBuildVersionfrom a version string.- Parameters:
- version- A string representation of a version
- Returns:
- a version representing a build or release of Elasticsearch
 
- 
fromStreamRead aBuildVersionfrom an input stream- Parameters:
- input- The stream to read
- Returns:
- a version representing a build or release of Elasticsearch
- Throws:
- IOException
 
- 
currentGet 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
 
 
-