go-elasticsearch

Elasticsearch 的官方 Go 客户端。『The official Go client for Elasticsearch』

Github星跟踪图

go-elasticsearch

The official Go client for Elasticsearch.

Download the latest version of Elasticsearch
or
sign-up
for a free trial of Elastic Cloud.

Go Reference
Go Report Card
codecov.io
Build
Unit
Integration
API

Compatibility

Go

Starting from version 8.12.0, this library follow the Go language policy. Each major Go release is supported until there are two newer major releases. For example, Go 1.5 was supported until the Go 1.7 release, and Go 1.6 was supported until the Go 1.8 release.

Elasticsearch

Language clients are forward compatible; meaning that clients support communicating with greater or equal minor versions of Elasticsearch.
Elasticsearch language clients are only backwards compatible with default distributions and without guarantees made.

When using Go modules, include the version in the import path, and specify either an explicit version or a branch:

require github.com/elastic/go-elasticsearch/v8 v8.0.0
require github.com/elastic/go-elasticsearch/v7 7.17

It's possible to use multiple versions of the client in a single project:

// go.mod
github.com/elastic/go-elasticsearch/v7 v7.17.0
github.com/elastic/go-elasticsearch/v8 v8.0.0

// main.go
import (
  elasticsearch7 "github.com/elastic/go-elasticsearch/v7"
  elasticsearch8 "github.com/elastic/go-elasticsearch/v8"
)
// ...
es7, _ := elasticsearch7.NewDefaultClient()
es8, _ := elasticsearch8.NewDefaultClient()

The main branch of the client is compatible with the current master branch of Elasticsearch.

Installation

Refer to the Installation section
of the getting started documentation.

Connecting

Refer to the Connecting section
of the getting started documentation.

Operations

Helpers

The esutil package provides convenience helpers for working with the client. At the moment, it provides the esutil.JSONReader() and the esutil.BulkIndexer helpers.

Examples

The _examples folder contains a number of recipes and comprehensive examples to get you started with the client, including configuration and customization of the client, using a custom certificate authority (CA) for security (TLS), mocking the transport for unit tests, embedding the client in a custom type, building queries, performing requests individually and in bulk, and parsing the responses.

License

This software is licensed under the Apache 2 license. See NOTICE.

主要指标

概览
名称与所有者elastic/go-elasticsearch
主编程语言Go
编程语言Makefile (语言数: 7)
平台
许可证Apache License 2.0
所有者活动
创建于2017-03-27 17:56:15
推送于2025-06-13 14:44:48
最后一次提交
发布数65
最新版本名称v9.0.0 (发布于 2025-04-17 18:34:23)
第一版名称v7.0.0-rc1 (发布于 2019-04-08 12:21:28)
用户参与
星数5.9k
关注者数375
派生数626
提交数694
已启用问题?
问题数355
打开的问题数61
拉请求数550
打开的拉请求数19
关闭的拉请求数86
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?