MCPcopy
hub / github.com/elastic/go-elasticsearch

github.com/elastic/go-elasticsearch @v9.4.2 sqlite

repository ↗ · DeepWiki ↗ · release v9.4.2 ↗
43,857 symbols 108,560 edges 5,668 files 26,222 documented · 60%
README

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 Build Unit Integration API Lint

Compatibility

Go

Starting from version 8.12.0, this library follows the Go language's release 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 backward 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/v9 v9.x.x
require github.com/elastic/go-elasticsearch/v8 v8.x.x

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

// go.mod
github.com/elastic/go-elasticsearch/v8 v8.18.0
github.com/elastic/go-elasticsearch/v9 v9.0.0

// main.go
import (
  elasticsearch8 "github.com/elastic/go-elasticsearch/v8"
  elasticsearch9 "github.com/elastic/go-elasticsearch/v9"
)
// ...
es8, _ := elasticsearch8.New()
es9, _ := elasticsearch9.New()

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

Installation

Refer to the Installation page of the documentation.

Connecting

Refer to the Connecting page of the 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.

Documentation

Find the full reference documentation at elastic.co:

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.

Extension points exported contracts — how you extend this code

Request (Interface)
Request defines the API request. [585 implementers]
esapi/esapi.request.go
Transport (Interface)
Transport defines the interface for an API client. [591 implementers]
esapi/esapi.go
Request (Interface)
Request defines the TypedApi requests. [585 implementers]
typedapi/typedclient.request.go
SettingsSimilarityVariant (Interface)
(no doc) [17 implementers]
typedapi/types/settingssimilarity.go
BulkResponseJSONDecoder (Interface)
BulkResponseJSONDecoder defines the interface for custom JSON decoders. [3 implementers]
esutil/bulk_indexer.go
JSONEncoder (Interface)
JSONEncoder defines the interface for custom JSON encoders. [2 implementers]
esutil/json_reader.go
LogFn (FuncType)
LogFn is a function called on each request for custom logging.
_examples/interceptor/internal/fake/server.go
RunnerFunc (FuncType)
RunnerFunc represents the runner operation.
_benchmarks/benchmarks/runner/runner.go

Core symbols most depended-on inside this repo

Set
called by 5261
typedapi/esdsl/processorcontainer.go
Close
called by 3184
esutil/bulk_indexer.go
Join
called by 2077
typedapi/esdsl/processorcontainer.go
Is
called by 1906
typedapi/types/elasticsearcherror.go
Token
called by 1887
typedapi/security/samllogout/saml_logout.go
String
called by 1413
typedapi/esdsl/like.go
Start
called by 1344
typedapi/ml/flushjob/flush_job.go
Add
called by 1274
esutil/bulk_indexer.go

Shape

Method 29,639
Function 5,886
Struct 5,509
FuncType 1,177
Interface 1,096
TypeAlias 550

Languages

Go100%

Modules by API surface

typedapi/api._.go727 symbols
typedapi/esdsl/tokenfilterdefinition.go152 symbols
typedapi/esdsl/property.go110 symbols
typedapi/esdsl/analyzer.go102 symbols
typedapi/esdsl/aggregations.go88 symbols
typedapi/core/search/search.go88 symbols
typedapi/asyncsearch/submit/submit.go84 symbols
typedapi/indices/putsettings/put_settings.go82 symbols
typedapi/fleet/search/search.go82 symbols
typedapi/indices/putdatastreamsettings/put_data_stream_settings.go77 symbols
typedapi/esdsl/query.go65 symbols
typedapi/esdsl/indexsettings.go62 symbols

Dependencies from manifests, versioned

dario.cat/mergov1.0.0 · 1×
github.com/Azure/go-ansitermv0.0.0-2021061722524 · 1×
github.com/Microsoft/go-winiov0.6.2 · 1×
github.com/andybalholm/brotliv1.2.0 · 1×
github.com/armon/go-radixv1.0.0 · 1×
github.com/cespare/xxhash/v2v2.3.0 · 1×
github.com/containerd/logv0.1.0 · 1×
github.com/containerd/platformsv0.2.1 · 1×
github.com/cpuguy83/dockercfgv0.3.2 · 1×
github.com/davecgh/go-spewv1.1.1 · 1×

For agents

$ claude mcp add go-elasticsearch \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact