import semver , { coerce } from 'semver' ; /**
 * Checks for the compatibilitiy between Elasticsearch and Kibana versions
 * 1. Major version differences will never work together.
 * 2. Older versions of ES won't work with newer versions of Kibana.
 */ export function esVersionCompatibleWithKibana ( esVersion , kibanaVersion ) { const esVersionNumbers = { major : semver . major ( esVersion ) , minor : semver . minor ( esVersion ) , patch : semver . patch ( esVersion ) , } ; const kibanaVersionNumbers = { major : semver . major ( kibanaVersion ) , minor : semver . minor ( kibanaVersion ) , patch : semver . patch ( kibanaVersion ) , } ; if ( esVersionNumbers . major !== kibanaVersionNumbers . major ) { return false ; } if ( esVersionNumbers . minor < kibanaVersionNumbers . minor ) { return false ; } return true ; } export function esVersionEqualsKibana ( nodeVersion , kibanaVersion ) { const nodeSemVer = coerce ( nodeVersion ) ; const kibanaSemver = coerce ( kibanaVersion ) ; return nodeSemVer && kibanaSemver && nodeSemVer . version === kibanaSemver . version ; }