index.asciidoc 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. = go-elasticsearch
  2. == Overview
  3. An official Go client for Elasticsearch.
  4. Full documentation is hosted at https://github.com/elastic/go-elasticsearch[GitHub]
  5. and https://godoc.org/github.com/elastic/go-elasticsearch[GoDoc]
  6. -- this page provides only an overview.
  7. === Elasticsearch Version Compatibility
  8. The client major versions correspond to the Elasticsearch major versions:
  9. to connect to Elasticsearch `6.x`, use a `6.x` version of the client,
  10. to connect to Elasticsearch `7.x`, use a `7.x` version of the client, and so on.
  11. The `master` branch of the client is compatible with the `master` branch of Elasticsearch.
  12. === Installation
  13. Add the package to your `go.mod` file:
  14. [source,text]
  15. ------------------------------------
  16. require github.com/elastic/go-elasticsearch/v7 7.x
  17. ------------------------------------
  18. === Usage
  19. [source,go]
  20. ------------------------------------
  21. package main
  22. import (
  23. "log"
  24. "github.com/elastic/go-elasticsearch/v7"
  25. )
  26. func main() {
  27. es, _ := elasticsearch.NewDefaultClient()
  28. log.Println(es.Info())
  29. }
  30. ------------------------------------
  31. [NOTE]
  32. Please have a look at the collection of comprehensive examples in the repository
  33. at https://github.com/elastic/go-elasticsearch/tree/master/_examples.
  34. == Resources
  35. * https://github.com/elastic/go-elasticsearch[Source Code]
  36. * https://godoc.org/github.com/elastic/go-elasticsearch[API Documentation]
  37. * https://github.com/elastic/go-elasticsearch/tree/master/_examples[Examples and Recipes]
  38. == License
  39. Copyright 2019 Elasticsearch
  40. Licensed under the Apache License, Version 2.0 (the "License");
  41. you may not use this file except in compliance with the License.
  42. You may obtain a copy of the License at
  43. http://www.apache.org/licenses/LICENSE-2.0
  44. Unless required by applicable law or agreed to in writing, software
  45. distributed under the License is distributed on an "AS IS" BASIS,
  46. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  47. See the License for the specific language governing permissions and
  48. limitations under the License.