Skip to content

Latest commit

 

History

History
86 lines (62 loc) · 1.83 KB

installation.asciidoc

File metadata and controls

86 lines (62 loc) · 1.83 KB

Installation

To install the 7.x version of the client, add the package to your go.mod file:

require github.com/elastic/go-elasticsearch/v7 7.x

Or, clone the repository:

git clone --branch 7.x 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.

You can find a complete example of installation below:

mkdir my-elasticsearch-app && cd my-elasticsearch-app

cat > go.mod <<-END
  module my-elasticsearch-app

  require github.com/elastic/go-elasticsearch/v8 master
END

cat > main.go <<-END
  package main

  import (
    "log"

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

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

go run main.go

{es} Version Compatibility

The client major versions correspond to the {es} major versions: to connect to {es} 7.x, use a 7.x version of the client, to connect to {es} 6.x, use a 6.x version of the client, and so on.

Note

While the 5.x version of the client is available, it is no longer actively maintained, neither the corresponding {es} version. For more information, refer to Elastic product end of life dates.

{es} Version Client Version

master

master

7.x

7.x

6.x

6.x

5.x

5.x

The master branch of the client is compatible with the master branch of {es}.