11[[elasticsearch-go-client-getting-started]]
2- = Get started with the serverless Go client
2+ = Get started with the Elasticsearch Go client
33
4- // :description: Set up and use the Go client for {es3} .
4+ // :description: Set up and use the Go client.
55// :keywords: serverless, elasticsearch, go, how to
66
77[NOTE]
@@ -17,7 +17,7 @@ client for {es3}, shows you how to initialize the client, and how to perform bas
1717[[elasticsearch-go-client-getting-started-requirements]]
1818== Requirements
1919
20- * Go 1.20 or higher installed on your system.
20+ * Go 1.22 or higher installed on your system.
2121
2222[discrete]
2323[[elasticsearch-go-client-getting-started-installation]]
@@ -32,7 +32,7 @@ commands:
3232
3333[source,bash]
3434----
35- go get -u github.com/elastic/elasticsearch-serverless-go @latest
35+ go get -u github.com/elastic/go-elasticsearch/v8 @latest
3636----
3737
3838[discrete]
@@ -50,9 +50,9 @@ import (
5050 "log"
5151 "strconv"
5252
53- "github.com/elastic/elasticsearch-serverless-go "
54- "github.com/elastic/elasticsearch-serverless-go /typedapi/types"
55- "github.com/elastic/elasticsearch-serverless-go /typedapi/types/enums/result"
53+ "github.com/elastic/go-elasticsearch/v8 "
54+ "github.com/elastic/go-elasticsearch/v8 /typedapi/types"
55+ "github.com/elastic/go-elasticsearch/v8 /typedapi/types/enums/result"
5656)
5757----
5858
@@ -64,12 +64,12 @@ Initialize the client using your API key and {es} endpoint:
6464
6565[source,go]
6666----
67- client, err := elasticsearch.NewClient (elasticsearch.Config{
68- APIKey: "you_api_key" ,
69- Address: "https://my-project-url ",
67+ client, err := elasticsearch.NewTypedClient (elasticsearch.Config{
68+ Addresses: []string{"https://my-project-url"} ,
69+ APIKey: "your-api-key ",
7070})
7171if err != nil {
72- log.Fatal( err)
72+ log.Fatalf("Error creating the client: %s", err)
7373}
7474----
7575
0 commit comments