The go-elasticsearch repository is the official Go client library for Elasticsearch, maintained by Elastic. It provides Go developers with a comprehensive interface to interact with Elasticsearch clusters, supporting all major operations including index creation, document indexing and retrieval, searching, updating, and deletion. The client is written in Go and serves as a critical component in the Elastic Stack ecosystem for applications requiring search and analytics capabilities.
The library offers both low-level and typed API approaches for interacting with Elasticsearch. The typed API provides compile-time safety and better developer experience, while the low-level API offers flexibility for advanced use cases. The client includes the esutil package with convenience helpers such as JSONReader and BulkIndexer to simplify common operations like bulk indexing of documents. Additional resources include esdsl builders for constructing complex queries and comprehensive examples in the _examples folder demonstrating configuration, customization, security setup with custom certificates, transport mocking for testing, and various query patterns.
Compatibility is a key design consideration for this client. Starting from version 8.12.0, the library follows Go's official release policy, supporting each major Go release until two newer major releases are available. The client maintains forward compatibility with Elasticsearch, meaning it supports communication with greater or equal minor versions of the target Elasticsearch instance. Multiple versions of the client can coexist in a single project through Go modules, allowing developers to gradually migrate between major versions. The main branch tracks the current master branch of Elasticsearch.
The repository shares contributors with other projects including github/gh-aw, solo-io/gloo, and longhorn/longhorn, indicating cross-project collaboration within the broader ecosystem.
The client supports comprehensive CRUD operations and search functionality, with detailed documentation available on elastic.co covering getting started, configuration, API usage patterns, typed API features, and advanced topics including interceptors and observability. Installation and connection setup are documented separately to guide users through initial setup. The library is licensed under the Apache 2 license, making it suitable for both open source and commercial applications.