agentleFS
ElasticKnown publisherelastic/go-elasticsearch/AGENTS.md

go-elasticsearch

AGENTS.md6.1k starsChanged 8 months agoApache-2.0View on GitHub

CLAUDE.md is a symlink to this file — they are the same file, do not update both. Official Elasticsearch Go client. Module: github.com/elastic/go-elasticsearch/v9. This is a public library with external consumers. Maintain backwards compatibility: PRs are squash-merged into a single commit when landing on main or a version branch. Because of this, each PR should represent one distinct, self-contained change — a single feature, bug fix, or refactor. Mixing unrelated changes in one PR means they become inseparable in history,…

Trending

Quiet since December.thin dataabout the whole repository

Dec 2025: 1 mentionJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the elastic/go-elasticsearch repository that our weekly crawl found: only 10 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Who's talking about elastic/go-elasticsearch

The biggest 5 of 10 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 10

Talked about on GitHub and Hacker News (10 times).

On GitHub · 9

4 more on GitHub

On Hacker News · 1

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

11 rules. About 0 are common, 9 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do NOT remove or rename exported types, functions, methods, or fields.

    line 12
  2. Distinctive:

    Do NOT change function/method signatures (parameter types, return types, receiver types).

    line 13
  3. Distinctive:

    Do NOT change the behavior of existing public APIs in a breaking way.

    line 14
  4. Distinctive:

    If a deprecation is needed, add a new API and mark the old one deprecated via godoc comment.

    line 16
  5. Distinctive:

    All Go files must include the Apache 2.0 license header:

    line 34
  6. Distinctive:

    All exported types and functions must have godoc comments.

    line 56
  7. Very specific:

    Before finishing, always run: make lint && make test-unit.

    line 57
  8. Distinctive:

    Keep each PR focused on a single logical change with a clear purpose.

    line 73
  9. Distinctive:

    Avoid bundling unrelated fixes or refactors into a feature PR — send them separately.

    line 74
  10. Distinctive:

    Prefer multiple small PRs over one large PR, even if they land in quick succession.

    line 75
  11. Very specific:

    When modifying dependencies, use make go-mod-tidy-all to tidy all modules.

    line 118

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

This file provides guidance to AI coding agents working with code in this repository. CLAUDE.md is a symlink to this file — they are the same file, do not update both.

Official Elasticsearch Go client. Module: github.com/elastic/go-elasticsearch/v9.

Backwards Compatibility

This is a public library with external consumers. Maintain backwards compatibility:

  • Do NOT remove or rename exported types, functions, methods, or fields.
  • Do NOT change function/method signatures (parameter types, return types, receiver types).
  • Do NOT change the behavior of existing public APIs in a breaking way.
  • Adding new exported symbols, new fields to config structs, or new methods is fine.
  • If a deprecation is needed, add a new API and mark the old one deprecated via godoc comment; do not remove it.

Commands

make test-unit                  # unit tests
go test -v -run TestName ./pkg  # single test
make test-integ                 # integration tests (requires ES)
make test-bench                 # benchmarks
make lint                       # go vet
make go-mod-tidy-all            # tidy all modules
make cluster                    # start ES in Docker
make gen-api                    # regenerate esapi/ from specs

Key Rules

  • DO NOT manually edit files in esapi/ or typedapi/ — they are generated. Use make gen-api.
  • All Go files must include the Apache 2.0 license header:
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.
  • Integration tests use build tag //go:build integration, unit tests use //go:build !integration.
  • All exported types and functions must have godoc comments.
  • Before finishing, always run: make lint && make test-unit.

Regeneration

  • make gen-api regenerates esapi/ from the REST spec. Commit only this output in regeneration PRs.
  • make gen-tests regenerates the YAML-driven tests in esapi/test/ and internal/build/cmd/generate/commands/gentests/api_registry.gen.go. This runs in Buildkite CI; do not commit its output locally.
  • Regenerating after a generator fix or long gap will include spec drift (new endpoints, reworded descriptions, additive fields). Mention it in the PR body alongside the motivating change.
  • make download-specs uses the Makefile's default version. Override with ELASTICSEARCH_BUILD_VERSION=X.Y.Z make download-specs when regenerating a version branch from a checkout whose default targets a different version.

Commits and Pull Requests

PRs are squash-merged into a single commit when landing on main or a version branch. Because of this, each PR should represent one distinct, self-contained change — a single feature, bug fix, or refactor. Mixing unrelated changes in one PR means they become inseparable in history, making reviews harder and reverts riskier (reverting one change would also revert the unrelated ones).

When planning work:

  • Break larger features into a sequence of small, independently mergeable PRs.
  • Keep each PR focused on a single logical change with a clear purpose.
  • Avoid bundling unrelated fixes or refactors into a feature PR — send them separately.
  • Prefer multiple small PRs over one large PR, even if they land in quick succession.

Breaking changes

Commits containing breaking API changes need a BREAKING-CHANGE: footer (preceded by a blank line) on a fix: or feat: commit. release-please reads the footer from the squash-merged commit to flag the release accordingly. Do not mark a breaking change as chore: or refactor:.

Architecture

Two Client Types

Both clients share BaseClient (transport, product-check, meta headers) but expose different API surfaces:

  • Client (functional API) — embeds *esapi.API. Created with NewClient(Config) or New(opts ...Option). Each API endpoint is a function-type field on the API struct that accepts functional options (func(*SearchRequest)).
  • TypedClient (typed API) — embeds *typedapi.MethodAPI. Created with NewTypedClient(Config) or NewTyped(opts ...Option). Each endpoint returns a fluent builder struct with typed request/response structs.

Package Layout

PathDescription
elasticsearch.goClient construction, Config, transport setup
options.goFunctional-options API (New(opts ...Option))
esapi/Auto-generated flat API methods (DO NOT EDIT)
typedapi/Auto-generated typed API builders (DO NOT EDIT)
esutil/Utility helpers (BulkIndexer, JSONReader)
internal/build/Code generator (cobra CLI, separate go.mod)
internal/testing/Integration/e2e tests (separate go.mod)
internal/version/Client version constant

Generated Code Patterns

esapi — each endpoint file (api.<name>.go) contains: a function-type alias (e.g. type Search func(...) (*Response, error)), a SearchRequest struct with all params, a Do(ctx, transport) method that builds the HTTP request, and WithXxx option functions.

typedapi — each endpoint is a separate package (typedapi/core/search/). Contains a builder struct with fluent setters, HttpRequest(ctx) to build the request, Perform(ctx) for raw response, and Do(ctx) for typed JSON-decoded response. Types live in typedapi/types/ (~2000 generated files).

Multi-Module Structure

The repo contains multiple Go modules (each with its own go.mod):

  • Root: main client library
  • internal/build/: esapi code generator (uses replace directive to reference root)
  • internal/testing/: integration tests
  • esapi/test/: generated YAML-driven API tests
  • _examples/*/: each example is a standalone module

When modifying dependencies, use make go-mod-tidy-all to tidy all modules.

Instrumentation & Interceptors

Two extensibility points, both from elastic-transport-go:

  • Instrumentation: lifecycle hooks per API call (Start, BeforeRequest, AfterRequest, RecordError, Close). Enabled via Config.Instrumentation. OTel adapter: NewOpenTelemetryInstrumentation(provider, captureSearchBody).
  • Interceptors: []InterceptorFunc middleware on the transport's RoundTripper. Set once at construction via Config.Interceptors. Applied left-to-right (outermost first).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.