Skip to content

add the elasticsearch plugin - #127

Merged
brandonphelps1212 merged 1 commit into
mainfrom
elasticsearch-plugin
Nov 19, 2026
Merged

brandonphelps1212 merged 1 commit into
mainfrom
elasticsearch-plugin

Conversation

@brandonphelps1212

Copy link
Copy Markdown
Contributor

What this changes

Adds the elasticsearch plugin on the openapi format plugin. Part of #73 (I11.5 · Watch Elasticsearch), under #14.

  • Source: output/openapi/elasticsearch-openapi.json in elastic/elasticsearch-specification, the specification Elastic generates its official clients and API reference from.
    • It reads the branch of the newest released minor version, pinned to that branch's head commit. That's 9.5 today, not the unreleased 9.6.
    • The newest released version is the highest version number among elastic/elasticsearch's releases, not releases/latest: 8.19 patches ship after 9.5 ones.
    • An event's version is that minor's first release (9.0.0). It's a real version number, which the clients' versions follow (elasticsearch-py 9.5.1), so the patch-it client's existing package gate handles it.
  • Reports: the deprecations-only rule (vercel, supabase, algolia-*), with the whole operation quoted and path templates matched.
    • operation deprecations;
    • removals (breaking) of operations marked deprecated first.
  • New openapi option, RemovalsNeedANewVersion, set only for Elasticsearch. It drops removals between two specs of the same version. A release branch's spec gets fixes after its .0 (the 9.2 branch dropped GET /_project/tags after 9.2.0), and Elasticsearch never removes an API in a patch, so such a removal is a spec correction.
  • History (8.14 to 9.6): 26 events.
    • 23 deprecations, for example rollups and legacy _template (8.17), /_application/analytics (9.0), and _flush (9.1).
    • 3 removals in 9.0: GET and POST /{index}/_knn_search, and POST /{index}/_unfreeze. Elastic's 9.0.0 breaking changes say "Remove unfreeze REST endpoint".

Checklist

  • Added to docs/plugins.md: new row in the 7-column shape (Layer API, status live per the current convention). docs/plugins.json regenerated (make plugins-json), and the README badge is now 21. I compared the registered plugins with the table.
  • Every commit is signed off (git commit -s, DCO)
  • Golden test over real saved copies (plugins/openapi/testdata/golden/elasticsearch.json): the replay of 8.19 → 9.0 gives the 3 removals and 5 deprecations.
  • testdata/README.md lists each file: URL at the pinned commit, date, license, quote. The copies keep openapi, info and the paths involved, every line unchanged. The 9.2 copy's "paths": {} is the one exception, and it's disclosed.
  • Pinned drop test: 9.1 → 9.2. Eight /_autoscaling and /_nodes/{node_id}/shutdown operations leave the spec without being deprecated; Elastic documents them as "designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported." No event; unfiltered, the pair reports all 8. Plus TestElasticsearchNoRemovalWithinAMinor.
  • providers/elasticsearch.md written from providers/_template.md, including Why this source
  • Fetches only through env.Get / kit/: the adapter uses the shared fetch layer under adapter/, like the other openapi adapters.
  • make check passes.
  • Nothing private: no credentials, internal hosts, private links, customer names

Notes for the reviewer

  • The 31 removals not deprecated first are dropped. They mostly weren't removals from Elasticsearch:
    • APIs a later minor of the older major has and the earlier-cut 9.0 branch didn't yet (8.19 → 9.0 drops /_data_stream/{name}/_options, back in 9.1);
    • the not-for-direct-use APIs left out of the spec from 9.2.
  • Not read:
    • the breaking-changes and deprecations pages, which are prose per area, mostly settings and behavior; they're used as a check on the spec;
    • 8.19-only deprecations, since the plugin follows the newest released minor;
    • property-level changes.
  • The live check ran the real adapter against GitHub. It picked branch 9.5, and the full-size 8.19 → 9.0 replay turned 4,127 raw changes into exactly the 8 events.
  • An independent review re-derived the whole history from every branch head and found no wrong events. Its one finding, removals within a branch, is the RemovalsNeedANewVersion fix above.

🤖 Generated with Claude Code

Watches the Elasticsearch REST API through the OpenAPI spec generated in
elastic/elasticsearch-specification, on the branch of the newest
released minor version, pinned to its head commit; an event's version is
that minor's .0 release. Uses the deprecations-only rule. The openapi
plugin gains RemovalsNeedANewVersion: a removal between two commits of
one release branch is a spec fix, since Elasticsearch never removes an
API in a patch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: brandonphelps1212 <bphelps1212@gmail.com>
@claude

claude Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Claude finished @brandonphelps1212's task in 2m 1s —— View job


✅ Ready to merge. The plugin follows every repo rule, every check I ran passes, and I found no path that could emit a wrong event.

Rules

Rule Status Evidence
Plugin list (Rule 1) ✅ The elasticsearch row is between the markers, in the 7-column shape, with absolute links only. docs/plugins.json and the README badge (21) are up to date: go test would fail on a stale JSON, and it passes. I compared the registered plugins with the table, and the row's id, provider, format and source match adapter.Elasticsearch and elasticsearch.go.
Provider page ✅ providers/elasticsearch.md has every section of _template.md. Why this source gives the link, the check date (2026-11-19), why the spec is the best source (Elastic generates its clients and API reference from it), three alternatives with reasons, and the quote "Remove unfreeze REST endpoint". It's also listed in providers/README.md.
Golden test and quote ✅ TestElasticsearchGolden replays 8.19 → 9.0 over saved copies pinned to a commit and gets 3 removals and 5 deprecations. It checks each event's source URL, that the excerpt contains "deprecated":true, and that the excerpt matches the node at SourcePointer. testdata/README.md has URL, date, license (Apache-2.0) and a quote for both pairs. The golden file is new, so nothing was edited.
Drop test ✅ TestElasticsearchDropsUndeprecatedRemovals replays 9.1 → 9.2 and expects no event. Without the filter, the same pair reports all 8 removals, which proves the input is realistic. TestElasticsearchNoRemovalWithinAMinor covers the new option.
Fetch only via env ✅ The adapter uses fetch.Get under adapter/. plugins/ has no net/http (searched), and only the tests read files, all under testdata/. contract/fixtures/ is untouched.
Nothing private (Rule 2) ✅ Code, docs, test data, the commit message and the PR body contain no credentials, internal names or private links. The leak guard is clean.

Bugs

None found. Things I checked specifically:

  • The new filter covers every removal the existing filter keeps. deprecationsOnly keeps only OperationRemoved among removals (plugins/openapi/vercel.go:60), so RemovalsNeedANewVersion filtering on that one kind is complete.
  • The new option only affects Elasticsearch. It is set only on Elasticsearch's registration, and the zero value leaves every other openapi plugin as it was.
  • Picking the newest version takes the highest number, not the newest by date. Prerelease and draft releases are skipped. If no matching spec branch exists, it returns an error instead of falling back to an older branch, which keeps it precise.
  • A failed spec fetch can't become events. Fetch pins to the commit SHA and rejects a body that isn't valid JSON, so an HTML error page can't be diffed.

Verified

Command Result
go build ./... ok
go vet ./... no output
gofmt -l . no output
go test -race ./... all packages pass, including adapter and plugins/openapi
python3 scripts/leak_guard.py --all "no banned terms (8 hashed terms checked)"
git log -1 Signed-off-by is present (DCO)

make todos, make nethttp and make imports needed approval in this job, so I couldn't run them. Instead I searched plugins/ for TODO(new-plugin) and net/http and found neither.

Non-blocking (optional)

  • A deprecation that lands mid-branch is dated by the minor's .0. Suppose 9.5 gains a deprecation at 9.5.4: the event gets version and previous_version both 9.5.0. The provider page documents this choice. It may be worth confirming that the client's package gate handles a version equal to the previous one the way you expect, since that pair can't occur for the other openapi plugins.
  • esReleasesURL reads only the first 100 releases. That's plenty with two majors receiving patches today. A short comment would help if someone ever wonders why it doesn't page.

Thanks for a careful PR: the explanation of the 31 dropped removals and the live-check numbers made it easy to review.

@brandonphelps1212
brandonphelps1212 merged commit f86e039 into main Nov 19, 2026
5 checks passed
@brandonphelps1212
brandonphelps1212 deleted the elasticsearch-plugin branch November 19, 2026 21:07
@brandonphelps1212 brandonphelps1212 mentioned this pull request Nov 19, 2026
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant