_parseVersion (response) {
    // Skip `this.handleError` if server is AOSS
    // They didn't implement `GET /` and will return 404 here, but we can hard-code
    // the version info by `server` in response header
    if (this.parent.options.openSearchServerless || response.headers.server === 'aoss-amazon') {
      return {
        version: this.parent.options['force-os-version'],
        distribution: 'opensearch-serverless',
        // See https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-overview.html
        // "Currently, serverless collections run OpenSearch version 2.0.x", as of May 13, 2025
        distributionVersion: '2.0.0',
        isOpenSearch: true
      }
    }

    const err = this.handleError(null, response)
    if (err) {
      throw err
    }

    const parsed = jsonParser.parse(response.body)
    if (!parsed.version) {
      // Fallback version
      this.parent.emit('debug', 'unable to detect version, using default: 5.0.0')
      return {
        version: '5.0.0',
        distribution: 'elasticsearch',
        distributionVersion: '5.0.0'
      }
    }

    if (parsed.version.distribution === 'opensearch') {
      return {
        version: this.parent.options['force-os-version'],
        distribution: 'opensearch',
        distributionVersion: parsed.version.number,
        isOpenSearch: true
      }
    }

    return {
      version: parsed.version.number,
      distribution: parsed.version.build_flavor === 'serverless' ? 'elasticsearch-serverless' : 'elasticserach',
      distributionVersion: parsed.version.number
    }
  }
@returns {{version: string, distribution: string, distributionVersion: string}}