elastic / go-elasticsearch

The official Go client for Elasticsearch
https://github.com/elastic/go-elasticsearch#go-elasticsearch
Apache License 2.0
5.54k stars 609 forks source link

Connect to Elasticsearch from AWS #782

Closed Zakisu closed 5 months ago

Zakisu commented 5 months ago

I use Elasticsearch from AWS, which operates on port 443 (default is 9200). When I try to connect, it always returns the error: 'The client noticed that the server is not Elasticsearch, and we do not support this unknown product.

When I trace the error message, it comes from this function: /go-elasticsearch-main/elasticsearch.go

func genuineCheckHeader(header http.Header) error {
    if header.Get("X-Elastic-Product") != "Elasticsearch" {
        return errors.New(unknownProduct)
    }
    return nil
}

how to solve this?

srri commented 5 months ago

You are either using a newer client against an older version of Elasticsearch on AWS (eg: version 8 client against version 7 ES), or you're trying to connect to an OpenSearch cluster in AWS (which is not the same as Elasticsearch).

Zakisu commented 5 months ago

You are either using a newer client against an older version of Elasticsearch on AWS (eg: version 8 client against version 7 ES), or you're trying to connect to an OpenSearch cluster in AWS (which is not the same as Elasticsearch).

Works! Thanks! previously i used python and works in ES library, so i tried use this lib in Golang

Anaethelion commented 5 months ago

Thank you @srri for the right answer, closing this issue.