﻿---
title: Installation
description: To install the 9.3.1 version of the client for Go, you can use the go get command: Or, add the package to your go.mod file: Or, clone the repository: 
url: https://www.elastic.co/elastic/docs-builder/docs/2755/reference/elasticsearch/clients/go/installation
products:
  - Elasticsearch
  - Elasticsearch Client
  - Elasticsearch Go Client
---

# Installation
To install the 9.3.1 version of the client for Go, you can use the `go get` command:
```shell
go get github.com/elastic/go-elasticsearch/v9@v9.3.1
```

Or, add the package to your `go.mod` file:
```text
require github.com/elastic/go-elasticsearch/v9 9.3
```

Or, clone the repository:
```text
git clone --branch 9.3 https://github.com/elastic/go-elasticsearch.git $GOPATH/src/github.com/elastic/go-elasticsearch
```

To install another version, modify the path or the branch name accordingly. The client major versions correspond to the Elasticsearch major versions.
You can find a complete example of installation below:
```shell
mkdir my-elasticsearch-app && cd my-elasticsearch-app && go mod init my-elasticsearch-app

go get github.com/elastic/go-elasticsearch/v9@v9.3.1

cat > main.go <<-END
  package main

  import (
    "context"
    "log"

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

  func main() {
    es, _ := elasticsearch.NewDefaultClient()
    defer es.Close(context.Background())
    log.Println(elasticsearch.Version)
    log.Println(es.Info())
  }
END

go run main.go
```


## Elasticsearch version compatibility

The language clients are forward compatible; meaning that the clients support communicating with greater or equal minor versions of Elasticsearch without breaking.
It does not mean that the clients automatically support new features of newer Elasticsearch 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 Elasticsearch, the 8.13 client version is required for that.
Elasticsearch language clients are only backward compatible with default distributions and without guarantees made.

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