in esrally/client/synchronous.py [0:0]
def check_product(cls, headers, response):
# type: (dict[str, str], dict[str, str]) -> int
"""
Verifies that the server we're talking to is Elasticsearch.
Does this by checking HTTP headers and the deserialized
response to the 'info' API. Returns one of the states above.
"""
version = response.get("version", {})
try:
version_number = versions.Version.from_string(version.get("number", None))
except TypeError:
# No valid 'version.number' field, either Serverless Elasticsearch, or not Elasticsearch at all
version_number = versions.Version.from_string("0.0.0")
build_flavor = version.get("build_flavor", None)
# Check all of the fields and headers for missing/valid values.
try:
bad_tagline = response.get("tagline", None) != "You Know, for Search"
bad_build_flavor = build_flavor not in ("default", "serverless")
bad_product_header = headers.get("x-elastic-product", None) != "Elasticsearch"
except (AttributeError, TypeError):
bad_tagline = True
bad_build_flavor = True
bad_product_header = True
# 7.0-7.13 and there's a bad 'tagline' or unsupported 'build_flavor'
if versions.Version.from_string("7.0.0") <= version_number < versions.Version.from_string("7.14.0"):
if bad_tagline:
return cls.UNSUPPORTED_PRODUCT
elif bad_build_flavor:
return cls.UNSUPPORTED_DISTRIBUTION
elif (
# No version or version less than 6.8.0, and we're not talking to a serverless elasticsearch
(version_number < versions.Version.from_string("6.8.0") and not versions.is_serverless(build_flavor))
# 6.8.0 and there's a bad 'tagline'
or (versions.Version.from_string("6.8.0") <= version_number < versions.Version.from_string("7.0.0") and bad_tagline)
# 7.14+ and there's a bad 'X-Elastic-Product' HTTP header
or (versions.Version.from_string("7.14.0") <= version_number and bad_product_header)
):
return cls.UNSUPPORTED_PRODUCT
return True