Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/reference/connecting.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ This section illustrates the best practices for leveraging the {{es}} client in
package httpexample

import (
"github.com/elastic/go-elasticsearch/v8"
"github.com/elastic/go-elasticsearch/v9"
)

var client *elasticsearch.Client
Expand Down Expand Up @@ -264,7 +264,7 @@ package httpexample

import (
"github.com/aws/aws-lambda-go/lambda"
"github.com/elastic/go-elasticsearch/v8"
"github.com/elastic/go-elasticsearch/v9"
)

var client *elasticsearch.Client
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/esql.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ import (
"fmt"
"log"

"github.com/elastic/go-elasticsearch/v8"
"github.com/elastic/go-elasticsearch/v8/typedapi/esql/query"
"github.com/elastic/go-elasticsearch/v9"
"github.com/elastic/go-elasticsearch/v9/typedapi/esql/query"
)

type Book struct {
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Go version 1.21+
To install the latest version of the client, run the following command:

```shell
go get github.com/elastic/go-elasticsearch/v8@latest
go get github.com/elastic/go-elasticsearch/v9@latest
```

Refer to the [*Installation*](/reference/installation.md) page to learn more.
Expand Down
28 changes: 27 additions & 1 deletion docs/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,46 @@ Full documentation is hosted at [GitHub](https://github.com/elastic/go-elasticse

## Usage [_usage]

:::::::{tab-set}

::::::{tab-item} Low-level API
```go
package main

import (
"log"

"github.com/elastic/go-elasticsearch/v7"
"github.com/elastic/go-elasticsearch/v9"
)

func main() {
es, _ := elasticsearch.NewDefaultClient()
log.Println(es.Info())
}
```
::::::

::::::{tab-item} Fully-typed API
```go
package main

import (
"context"
"log"

"github.com/elastic/go-elasticsearch/v9"
)

func main() {
es, _ := elasticsearch.NewTypedClient(elasticsearch.Config{
Addresses: []string{"http://localhost:9200"},
})
log.Println(es.Info().Do(context.Background()))
}
```
::::::

:::::::

::::{note}
Please have a look at the collection of comprehensive examples in the repository at [https://github.com/elastic/go-elasticsearch/tree/master/_examples](https://github.com/elastic/go-elasticsearch/tree/master/_examples).
Expand Down
16 changes: 8 additions & 8 deletions docs/reference/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ mapped_pages:
To install the 8.x version of the client, add the package to your `go.mod` file:

```text
require github.com/elastic/go-elasticsearch/v8 8.5
require github.com/elastic/go-elasticsearch/v9 9.0
```

Or, clone the repository:

```text
git clone --branch 8.5 https://github.com/elastic/go-elasticsearch.git $GOPATH/src/github
git clone --branch 9.0 https://github.com/elastic/go-elasticsearch.git $GOPATH/src/github
```

To install another version, modify the path or the branch name accordingly. The client major versions correspond to the {{es}} major versions.
Expand All @@ -27,7 +27,7 @@ mkdir my-elasticsearch-app && cd my-elasticsearch-app
cat > go.mod <<-END
module my-elasticsearch-app

require github.com/elastic/go-elasticsearch/v8 main
require github.com/elastic/go-elasticsearch/v9 main
END

cat > main.go <<-END
Expand All @@ -36,7 +36,7 @@ cat > main.go <<-END
import (
"log"

"github.com/elastic/go-elasticsearch/v8"
"github.com/elastic/go-elasticsearch/v9"
)

func main() {
Expand All @@ -55,8 +55,8 @@ go run main.go
The language clients are forward compatible; meaning that the clients support communicating with greater or equal minor versions of {{es}} without breaking. It does not mean that the clients automatically support new features of newer {{es}} versions; it is only possible after a release of a new client version. For example, a 8.12 client version won’t automatically support the new features of the 8.13 version of {{es}}, the 8.13 client version is required for that. {{es}} language clients are only backwards compatible with default distributions and without guarantees made.

| Elasticsearch Version | Elasticsearch-Go Branch | Supported |
| --- | --- | --- |
| main | main | |
| 8.x | 8.x | 8.x |
| 7.x | 7.x | 7.17 |
|-----------------------|-------------------------|-----------|
| main | main | |
| 9.x | 9.x | 9.x |
| 8.x | 8.x | 8.x |