I'm working on using Elasticsearch in Go, I followed this guide: https://developer.okta.com/blog/2021/04/23/elasticsearch-go-developers-guide
I set up Elastic with docker. Verify that Elasticsearch is running:
$ curl http://localhost:9200
{
"name" : "0e9e2916eca5",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "jh8PVKNASpO3uK87Jzoq6Q",
"version" : {
"number" : "7.5.2",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "8bec50e1e0ad29dad5653712cf3bb580cd1afcdf",
"build_date" : "2020-01-15T12:11:52.313576Z",
"build_snapshot" : false,
"lucene_version" : "8.3.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
Also from the browser seems fine.
Next I set up a sample Go program just to test it out:
package main
import (
"testing"
"github.com/elastic/go-elasticsearch/v8"
)
func Test_elastic(t *testing.T) {
es, err := elasticsearch.NewDefaultClient()
if err != nil {
panic(err)
}
res, err := es.Info()
if err != nil {
panic(err)
}
defer res.Body.Close()
}
but res returns with err:
"the client noticed that the server is not Elasticsearch and we do not support this unknown product"
Digging in the code I see it verifies the response by looking for header.Get("X-Elastic-Product") == "Elasticsearch".
I have no idea why it's not working and I couldn't find any reference for this error online... would appreciate any input on this.