From 8e815e005186788ec7463f84de2afc9c055d5d53 Mon Sep 17 00:00:00 2001 From: brandonphelps1212 Date: Thu, 19 Nov 2026 16:04:06 -0500 Subject: [PATCH] add the elasticsearch plugin 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 Signed-off-by: brandonphelps1212 --- README.md | 2 +- adapter/elasticsearch.go | 131 ++++ adapter/elasticsearch_test.go | 86 +++ docs/plugins.json | 12 +- docs/plugins.md | 1 + plugins/openapi/elasticsearch.go | 24 + plugins/openapi/elasticsearch_test.go | 166 ++++ plugins/openapi/openapi.go | 28 +- plugins/openapi/registered_test.go | 2 +- plugins/openapi/testdata/README.md | 4 + .../testdata/elasticsearch-8.19-fd5d063c.json | 718 ++++++++++++++++++ .../testdata/elasticsearch-9.0-57ecfe5f.json | 237 ++++++ .../testdata/elasticsearch-9.1-12639d0e.json | 526 +++++++++++++ .../testdata/elasticsearch-9.2-87a82640.json | 12 + .../testdata/golden/elasticsearch.json | 170 +++++ providers/README.md | 1 + providers/elasticsearch.md | 53 ++ 17 files changed, 2167 insertions(+), 6 deletions(-) create mode 100644 adapter/elasticsearch.go create mode 100644 adapter/elasticsearch_test.go create mode 100644 plugins/openapi/elasticsearch.go create mode 100644 plugins/openapi/elasticsearch_test.go create mode 100644 plugins/openapi/testdata/elasticsearch-8.19-fd5d063c.json create mode 100644 plugins/openapi/testdata/elasticsearch-9.0-57ecfe5f.json create mode 100644 plugins/openapi/testdata/elasticsearch-9.1-12639d0e.json create mode 100644 plugins/openapi/testdata/elasticsearch-9.2-87a82640.json create mode 100644 plugins/openapi/testdata/golden/elasticsearch.json create mode 100644 providers/elasticsearch.md diff --git a/README.md b/README.md index 0fa19d7..3f0fad6 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![Go Reference](https://pkg.go.dev/badge/github.com/patch-it-dev/patch-it-plugins.svg)](https://pkg.go.dev/github.com/patch-it-dev/patch-it-plugins) [![Go version](https://img.shields.io/github/go-mod/go-version/patch-it-dev/patch-it-plugins)](go.mod) [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-3f5bf0)](LICENSE) -[![Plugins](https://img.shields.io/badge/plugins-20-3f5bf0)](docs/plugins.md) +[![Plugins](https://img.shields.io/badge/plugins-21-3f5bf0)](docs/plugins.md) [![Docs](https://img.shields.io/badge/docs-docs.patch--it.dev-3f5bf0)](https://docs.patch-it.dev) [![Discussions](https://img.shields.io/github/discussions/patch-it-dev/patch-it-plugins)](https://github.com/patch-it-dev/patch-it-plugins/discussions) diff --git a/adapter/elasticsearch.go b/adapter/elasticsearch.go new file mode 100644 index 0000000..9a7c36f --- /dev/null +++ b/adapter/elasticsearch.go @@ -0,0 +1,131 @@ +package adapter + +import ( + "context" + "encoding/json" + "fmt" + "regexp" + "strconv" + "strings" + + "github.com/patch-it-dev/patch-it-plugins/fetch" +) + +// Variables, not constants, only so tests can point them at a local server. +var ( + // esReleasesURL is Elasticsearch's own releases, newest first by date (an + // 8.19 patch can come after a 9.5 one), so the newest version is computed, + // not taken from releases/latest. + esReleasesURL = "https://api.github.com/repos/elastic/elasticsearch/releases?per_page=100" + // esBranchesURL lists every branch of elastic/elasticsearch-specification + // in one response (the branches API pages; this doesn't): one per minor + // version, "9.5". + esBranchesURL = "https://api.github.com/repos/elastic/elasticsearch-specification/git/matching-refs/heads/" + // esCommitURL is a branch's head commit. + esCommitURL = "https://api.github.com/repos/elastic/elasticsearch-specification/commits/%s" + // esSpecURLTemplate is the OpenAPI spec generated from the specification + // (the one Elastic's clients and API reference are built from) at one + // commit. The OpenAPI output starts with the 8.14 branch. + esSpecURLTemplate = "https://raw.githubusercontent.com/elastic/elasticsearch-specification/%s/output/openapi/elasticsearch-openapi.json" +) + +// Elasticsearch adapts the Elasticsearch REST API spec in +// elastic/elasticsearch-specification for the openapi plugin, minor version +// by minor version. A tag here is a minor version's branch ("9.5"). +type Elasticsearch struct{} + +var _ Adapter = Elasticsearch{} + +func (Elasticsearch) API() string { return "elasticsearch" } + +var ( + esRelease = regexp.MustCompile(`^v(\d+)\.(\d+)\.(\d+)$`) + esBranch = regexp.MustCompile(`^(\d+)\.(\d+)$`) +) + +// LatestTag is the branch of the newest minor version Elastic has released: +// not the newest branch, which is the next, unreleased one (9.6 on +// 2026-11-19, when the newest release was 9.5.6), whose spec can still +// change before it ships. +func (Elasticsearch) LatestTag(ctx context.Context) (string, error) { + body, err := fetch.Get(ctx, esReleasesURL, githubHeaders()) + if err != nil { + return "", fmt.Errorf("listing elasticsearch releases: %w", err) + } + var releases []struct { + Tag string `json:"tag_name"` + Prerelease bool `json:"prerelease"` + Draft bool `json:"draft"` + } + if err := json.Unmarshal(body, &releases); err != nil { + return "", fmt.Errorf("parsing github releases: %w", err) + } + newest := [2]int{-1, -1} + for _, r := range releases { + m := esRelease.FindStringSubmatch(r.Tag) + if m == nil || r.Prerelease || r.Draft { + continue + } + v := [2]int{atoi(m[1]), atoi(m[2])} + if v[0] > newest[0] || v[0] == newest[0] && v[1] > newest[1] { + newest = v + } + } + if newest[0] < 0 { + return "", fmt.Errorf("github lists no elasticsearch release") + } + + body, err = fetch.Get(ctx, esBranchesURL, githubHeaders()) + if err != nil { + return "", fmt.Errorf("listing elasticsearch-specification branches: %w", err) + } + var refs []struct { + Ref string `json:"ref"` + } + if err := json.Unmarshal(body, &refs); err != nil { + return "", fmt.Errorf("parsing github branch refs: %w", err) + } + want := fmt.Sprintf("%d.%d", newest[0], newest[1]) + for _, r := range refs { + if strings.TrimPrefix(r.Ref, "refs/heads/") == want { + return want, nil + } + } + return "", fmt.Errorf("elasticsearch %s is released, but elasticsearch-specification has no %s branch", want, want) +} + +func atoi(s string) int { + n, _ := strconv.Atoi(s) + return n +} + +// Fetch downloads the spec at the head of the branch, pinned to that commit: +// a branch moves (fixes land on it after the release), a commit doesn't. +// +// Version is the minor's first release, "9.5.0": what a repo pins, and the +// elasticsearch clients' versions follow the server's (elasticsearch-py 9.x +// for Elasticsearch 9.x). info.version in the spec is empty. +func (Elasticsearch) Fetch(ctx context.Context, branch string) (Spec, error) { + if !esBranch.MatchString(branch) { + return Spec{}, fmt.Errorf("%q isn't an elasticsearch-specification minor branch", branch) + } + meta, err := fetch.Get(ctx, fmt.Sprintf(esCommitURL, branch), githubHeaders()) + if err != nil { + return Spec{}, fmt.Errorf("looking up the head of elasticsearch-specification %s: %w", branch, err) + } + var commit struct { + SHA string `json:"sha"` + } + if err := json.Unmarshal(meta, &commit); err != nil || commit.SHA == "" { + return Spec{}, fmt.Errorf("elasticsearch-specification %s: no head commit", branch) + } + url := fmt.Sprintf(esSpecURLTemplate, commit.SHA) + body, err := fetch.Get(ctx, url, nil) // raw.githubusercontent.com needs no auth + if err != nil { + return Spec{}, fmt.Errorf("fetching the elasticsearch %s spec: %w", branch, err) + } + if !json.Valid(body) { + return Spec{}, fmt.Errorf("the elasticsearch %s spec is not valid json", branch) + } + return Spec{Content: body, Version: branch + ".0", SourceURL: url}, nil +} diff --git a/adapter/elasticsearch_test.go b/adapter/elasticsearch_test.go new file mode 100644 index 0000000..a84f7b5 --- /dev/null +++ b/adapter/elasticsearch_test.go @@ -0,0 +1,86 @@ +package adapter + +import ( + "context" + "net/http" + "net/http/httptest" + "strings" + "testing" +) + +func fakeESGitHub(t *testing.T, releases, branches string, heads, specs map[string]string) *httptest.Server { + t.Helper() + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch { + case r.URL.Path == "/releases": + w.Write([]byte(releases)) + case r.URL.Path == "/branches": + w.Write([]byte(branches)) + case strings.HasPrefix(r.URL.Path, "/commits/"): + sha, ok := heads[strings.TrimPrefix(r.URL.Path, "/commits/")] + if !ok { + http.NotFound(w, r) + return + } + w.Write([]byte(`{"sha":"` + sha + `"}`)) + default: + body, ok := specs[r.URL.Path] + if !ok { + http.NotFound(w, r) + return + } + w.Write([]byte(body)) + } + })) + t.Cleanup(srv.Close) + a, b, c, d := esReleasesURL, esBranchesURL, esCommitURL, esSpecURLTemplate + esReleasesURL, esBranchesURL = srv.URL+"/releases", srv.URL+"/branches" + esCommitURL, esSpecURLTemplate = srv.URL+"/commits/%s", srv.URL+"/%s/spec.json" + t.Cleanup(func() { esReleasesURL, esBranchesURL, esCommitURL, esSpecURLTemplate = a, b, c, d }) + return srv +} + +const esBranches = `[{"ref":"refs/heads/main"},{"ref":"refs/heads/8.19"},{"ref":"refs/heads/9.5"},{"ref":"refs/heads/9.6"}]` + +// The newest released minor, not the newest branch (9.6 isn't released), and +// not the newest release by date (8.19.25 came out after 9.5.6). +func TestElasticsearchLatestTagIsTheNewestReleasedMinor(t *testing.T) { + fakeESGitHub(t, `[{"tag_name":"v8.19.25"},{"tag_name":"v9.5.6"},{"tag_name":"v9.6.0-rc1","prerelease":true},{"tag_name":"v9.4.9"}]`, esBranches, nil, nil) + tag, err := Elasticsearch{}.LatestTag(context.Background()) + if err != nil || tag != "9.5" { + t.Errorf("got %q, %v; want 9.5", tag, err) + } +} + +func TestElasticsearchLatestTagFailures(t *testing.T) { + fakeESGitHub(t, `[{"tag_name":"v9.6.0-rc1","prerelease":true}]`, esBranches, nil, nil) + if _, err := (Elasticsearch{}).LatestTag(context.Background()); err == nil { + t.Error("no release: want an error") + } + fakeESGitHub(t, `[{"tag_name":"v9.7.0"}]`, esBranches, nil, nil) + if _, err := (Elasticsearch{}).LatestTag(context.Background()); err == nil { + t.Error("a release with no spec branch: want an error, not an older branch") + } +} + +// Pinned to the branch head's commit; the version is the minor's .0 release. +func TestElasticsearchFetchPinsTheHead(t *testing.T) { + const sha = "57ecfe5fda6976b94fc8b8830ecb51f4969dccd6" + srv := fakeESGitHub(t, "", "", map[string]string{"9.0": sha}, map[string]string{"/" + sha + "/spec.json": `{"openapi":"3.0.3","info":{"version":""},"paths":{}}`}) + spec, err := Elasticsearch{}.Fetch(context.Background(), "9.0") + if err != nil { + t.Fatal(err) + } + if spec.Version != "9.0.0" || spec.SourceURL != srv.URL+"/"+sha+"/spec.json" { + t.Errorf("got %q %s", spec.Version, spec.SourceURL) + } + for _, b := range []string{"main", "v9.0", "9.0.1"} { + if _, err := (Elasticsearch{}).Fetch(context.Background(), b); err == nil { + t.Errorf("%s: want an error", b) + } + } + fakeESGitHub(t, "", "", map[string]string{"9.0": sha}, map[string]string{"/" + sha + "/spec.json": ""}) + if _, err := (Elasticsearch{}).Fetch(context.Background(), "9.0"); err == nil { + t.Error("invalid json: want an error") + } +} diff --git a/docs/plugins.json b/docs/plugins.json index b7eb317..31ad65e 100644 --- a/docs/plugins.json +++ b/docs/plugins.json @@ -1,7 +1,7 @@ { "_comment": "Generated from the plugin registry and docs/plugins.md by `make plugins-json` (go run ./cmd/list-plugins). Don't edit by hand.", "$schema": "./plugins.schema.json", - "count": 20, + "count": 21, "plugins": [ { "id": "algolia-ingestion", @@ -73,6 +73,16 @@ "status": "live", "provider_page": "providers/datadog.md" }, + { + "id": "elasticsearch", + "provider": "Elastic", + "layer": "api", + "watches": "Elasticsearch REST API operations deprecated, and deprecated operations removed, between released minor versions of the spec", + "format": "openapi", + "source_url": "https://github.com/elastic/elasticsearch-specification", + "status": "live", + "provider_page": "providers/elasticsearch.md" + }, { "id": "github", "provider": "GitHub", diff --git a/docs/plugins.md b/docs/plugins.md index ef0bbc9..7283a01 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -18,6 +18,7 @@ The table between the `plugins:start` and `plugins:end` markers is also publishe | [`algolia-search`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/algolia.md) | Algolia | API | Search API operations deprecated, and deprecated operations removed, between releases of the spec | `openapi` | [algolia/api-clients-automation](https://github.com/algolia/api-clients-automation) (`specs/bundled/search.yml`) | live | | [`algolia-ingestion`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/algolia.md) | Algolia | API | Ingestion API operations deprecated, and deprecated operations removed, between releases of the spec | `openapi` | [algolia/api-clients-automation](https://github.com/algolia/api-clients-automation) (`specs/bundled/ingestion.yml`) | live | | [`algolia-recommend`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/algolia.md) | Algolia | API | Recommend API operations deprecated, and deprecated operations removed, between releases of the spec | `openapi` | [algolia/api-clients-automation](https://github.com/algolia/api-clients-automation) (`specs/bundled/recommend.yml`) | live | +| [`elasticsearch`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/elasticsearch.md) | Elastic | API | Elasticsearch REST API operations deprecated, and deprecated operations removed, between released minor versions of the spec | `openapi` | [elastic/elasticsearch-specification](https://github.com/elastic/elasticsearch-specification) (`output/openapi/elasticsearch-openapi.json`) | live | | [`mongodb-atlas`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/mongodb-atlas.md) | MongoDB | API | Atlas Administration API versions deprecated and removed at their sunset date, per endpoint, from MongoDB's own API changelog | `apichangelog` | [mongodb/openapi `changelog/changelog.json`](https://github.com/mongodb/openapi/blob/main/changelog/changelog.json) | live | | [`openai-models`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/openai-models.md) | OpenAI | AI models | Model deprecations and shutdown dates (Chat Completions and Responses text models) | `retirements` | [OpenAI deprecations](https://developers.openai.com/api/docs/deprecations) | live | | [`anthropic-models`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/anthropic-models.md) | Anthropic | AI models | Model deprecations and retirement dates (Messages API models) | `retirements` | [Anthropic model deprecations](https://platform.claude.com/docs/en/about-claude/model-deprecations) | live | diff --git a/plugins/openapi/elasticsearch.go b/plugins/openapi/elasticsearch.go new file mode 100644 index 0000000..1f43b2b --- /dev/null +++ b/plugins/openapi/elasticsearch.go @@ -0,0 +1,24 @@ +package openapi + +import "github.com/patch-it-dev/patch-it-plugins/diff" + +// elasticsearchDiff reads Elastic's spec like Supabase's: deprecations by the +// `deprecated` flag, quoting the whole operation, and path templates matched. +var elasticsearchDiff = diff.Options{PathTemplates: true, QuoteDeprecatedOperation: true} + +// elasticsearchKeep keeps operation deprecations, and removals of operations +// marked deprecated first. Over the minor versions with an OpenAPI output +// (8.14 to 9.6, compared in version order) that's 23 deprecations and 3 +// removals, all in 9.0: GET and POST /{index}/_knn_search, and POST +// /{index}/_unfreeze ("Remove unfreeze REST endpoint", Elastic's 9.0.0 +// breaking changes). The 31 other removals weren't deprecated first and +// mostly weren't removals from Elasticsearch: +// +// - APIs a later minor of the older major had and the newer major's +// branch, cut earlier, didn't yet: 8.19 to 9.0 drops +// /_data_stream/{name}/_options, which is back in 9.1; +// - APIs Elastic documents as not for direct use ("designed for indirect +// use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic +// Cloud on Kubernetes. Direct use is not supported."), left out of the +// spec from 9.2: /_autoscaling, /_nodes/{node_id}/shutdown. +var elasticsearchKeep = deprecationsOnly(elasticsearchDiff) diff --git a/plugins/openapi/elasticsearch_test.go b/plugins/openapi/elasticsearch_test.go new file mode 100644 index 0000000..0a57679 --- /dev/null +++ b/plugins/openapi/elasticsearch_test.go @@ -0,0 +1,166 @@ +package openapi + +import ( + "context" + "fmt" + "os" + "strings" + "testing" + + "github.com/patch-it-dev/patch-it-plugins/adapter" + "github.com/patch-it-dev/patch-it-plugins/event" + "github.com/patch-it-dev/patch-it-plugins/kit/kittest" +) + +// esHeads are the elasticsearch-specification branch heads saved under +// testdata/ (trimmed to the endpoints involved, every line unchanged; checked +// 2026-11-19): branch -> full SHA. +var esHeads = map[string]string{ + "8.19": "fd5d063c4824de5d33618b7fca4df0e6c1b8489f", + "9.0": "57ecfe5fda6976b94fc8b8830ecb51f4969dccd6", + "9.1": "12639d0e5ec07f064c909f15160ff68d608dbc2c", + "9.2": "87a82640d8aa1139163dc7071bf00f971ce5e453", +} + +type fakeESAdapter struct{} + +func (fakeESAdapter) API() string { return "elasticsearch" } + +func (fakeESAdapter) LatestTag(context.Context) (string, error) { return "", fmt.Errorf("replay only") } + +func (fakeESAdapter) Fetch(_ context.Context, branch string) (adapter.Spec, error) { + if _, ok := esHeads[branch]; !ok { + return adapter.Spec{}, fmt.Errorf("no saved copy for %s", branch) + } + body, err := os.ReadFile(esFile(branch)) + if err != nil { + return adapter.Spec{}, err + } + return adapter.Spec{Content: body, Version: branch + ".0", SourceURL: esURL(branch)}, nil +} + +func esFile(branch string) string { + return "testdata/elasticsearch-" + branch + "-" + esHeads[branch][:8] + ".json" +} + +func esURL(branch string) string { + return "https://raw.githubusercontent.com/elastic/elasticsearch-specification/" + esHeads[branch] + "/output/openapi/elasticsearch-openapi.json" +} + +func esPlugin() Plugin { + return Plugin{Adapter: fakeESAdapter{}, Diff: elasticsearchDiff, Keep: elasticsearchKeep, RemovalsNeedANewVersion: true} +} + +// sameMinor serves two saved specs as two commits of one branch: both 9.0.0. +type sameMinor struct{ fakeESAdapter } + +func (s sameMinor) Fetch(ctx context.Context, branch string) (adapter.Spec, error) { + spec, err := s.fakeESAdapter.Fetch(ctx, branch) + spec.Version = "9.0.0" + return spec, err +} + +// A release branch's spec gets fixes after its .0 release (the 9.2 branch +// dropped GET /_project/tags after 9.2.0), and Elasticsearch removes APIs in +// a new minor or major, never a patch: a removal between two commits of one +// minor is a correction to the spec, even of a deprecated operation. The +// same specs as the golden test, read as one branch, keep the five +// deprecations and none of the three removals. +func TestElasticsearchNoRemovalWithinAMinor(t *testing.T) { + ctx := context.Background() + s := openStore(t) + p := esPlugin() + p.Adapter = sameMinor{} + if rejected, err := kittest.Replay(ctx, vercelEnv(s), s, p, "8.19", "9.0"); err != nil || rejected { + t.Fatalf("replay: rejected=%v err=%v", rejected, err) + } + n := map[event.ChangeType]int{} + for _, e := range kittest.Stored(t, s) { + n[e.ChangeType]++ + } + if n[event.ChangeTypeBreaking] != 0 || n[event.ChangeTypeDeprecation] != 5 { + t.Errorf("got %v, want 5 deprecations and no removal", n) + } +} + +// The golden test and the historical breaking change: Elasticsearch 9.0. +// GET and POST /{index}/_knn_search and POST /{index}/_unfreeze, deprecated +// in 8.x, are gone ("Remove unfreeze REST endpoint", Elastic's 9.0.0 +// breaking changes), and the five /_application/analytics operations are +// deprecated. /_data_stream/{name}/_options, which 8.19 has and the 9.0 +// branch (cut earlier) doesn't, was never deprecated: no event. +func TestElasticsearchGolden(t *testing.T) { + ctx := context.Background() + s := openStore(t) + if rejected, err := kittest.Replay(ctx, vercelEnv(s), s, esPlugin(), "8.19", "9.0"); err != nil || rejected { + t.Fatalf("replay: rejected=%v err=%v", rejected, err) + } + events := kittest.Stored(t, s) + byType := map[event.ChangeType][]string{} + for _, e := range events { + byType[e.ChangeType] = append(byType[e.ChangeType], e.Subject.Operation) + if e.Version != "9.0.0" || e.PreviousVersion != "8.19.0" { + t.Errorf("%s: version %s from %s", e.Subject.Operation, e.Version, e.PreviousVersion) + } + want := esURL("9.0") + if e.Breaking { + want = esURL("8.19") // a removal is evidenced by the old spec + } + if e.SourceURL != want || !strings.Contains(e.SourceExcerpt, `"deprecated":true`) { + t.Errorf("%s: cited %s, excerpt %.120s", e.Subject.Operation, e.SourceURL, e.SourceExcerpt) + } + file := esFile("9.0") + if e.Breaking { + file = esFile("8.19") + } + if node := jsonNode(t, file, e.SourcePointer); node != e.SourceExcerpt && !truncated(e.SourceExcerpt, node) { + t.Errorf("%s: excerpt doesn't match %s#%s", e.Subject.Operation, file, e.SourcePointer) + } + } + breaking := strings.Join(byType[event.ChangeTypeBreaking], ", ") + for _, op := range []string{"GET /{index}/_knn_search", "POST /{index}/_knn_search", "POST /{index}/_unfreeze"} { + if !strings.Contains(breaking, op) { + t.Errorf("no removal of %s in %s", op, breaking) + } + } + if len(byType[event.ChangeTypeBreaking]) != 3 || len(byType[event.ChangeTypeDeprecation]) != 5 { + t.Errorf("got %v, want 3 removals and 5 /_application/analytics deprecations", byType) + } + for _, op := range byType[event.ChangeTypeDeprecation] { + if !strings.Contains(op, " /_application/analytics") { + t.Errorf("unexpected deprecation %s", op) + } + } + kittest.Golden(t, "testdata/golden/elasticsearch.json", events) +} + +// The pinned drop test. From 9.2 the spec leaves out /_autoscaling and +// /_nodes/{node_id}/shutdown, which Elastic documents as "designed for +// indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and +// Elastic Cloud on Kubernetes. Direct use is not supported." Never +// deprecated: no event, though unfiltered the pair reports them removed. +func TestElasticsearchDropsUndeprecatedRemovals(t *testing.T) { + ctx := context.Background() + s := openStore(t) + if rejected, err := kittest.Replay(ctx, vercelEnv(s), s, esPlugin(), "9.1", "9.2"); err != nil || rejected { + t.Fatalf("replay: rejected=%v err=%v", rejected, err) + } + if events := kittest.Stored(t, s); len(events) != 0 { + t.Fatalf("%d events, want none", len(events)) + } + s = openStore(t) + p := esPlugin() + p.Keep = nil + if _, err := kittest.Replay(ctx, vercelEnv(s), s, p, "9.1", "9.2"); err != nil { + t.Fatal(err) + } + var removed int + for _, e := range kittest.Stored(t, s) { + if e.Breaking && (strings.Contains(e.Subject.Operation, "/_autoscaling") || strings.Contains(e.Subject.Operation, "/shutdown")) { + removed++ + } + } + if removed != 8 { + t.Errorf("unfiltered: %d removals, want the 8 autoscaling and shutdown operations", removed) + } +} diff --git a/plugins/openapi/openapi.go b/plugins/openapi/openapi.go index fa518af..ccc310c 100644 --- a/plugins/openapi/openapi.go +++ b/plugins/openapi/openapi.go @@ -1,8 +1,9 @@ // Package openapi is the source plugin for an API that publishes an OpenAPI // spec per release (Stripe, Datadog, GitLab, GitHub, Vercel, Supabase, -// Algolia): fetch the newest spec, diff it against the last one seen, -// normalize the changes into events, and attach migration hints from the -// API's changelog when it has one. It can also replay two given releases. +// Algolia, Elasticsearch): fetch the newest spec, diff it against the last +// one seen, normalize the changes into events, and attach migration hints +// from the API's changelog when it has one. It can also replay two given +// releases. package openapi import ( @@ -41,6 +42,9 @@ func init() { for _, spec := range []string{"search", "ingestion", "recommend"} { plugin.Register(Plugin{Adapter: adapter.Algolia{Spec: spec}, Diff: algoliaDiff, Keep: algoliaKeep}) } + // No Hints: Elastic's breaking-changes page is prose per area, not keyed + // by operation. See elasticsearch.go. + plugin.Register(Plugin{Adapter: adapter.Elasticsearch{}, Diff: elasticsearchDiff, Keep: elasticsearchKeep, RemovalsNeedANewVersion: true}) } // requestSide keeps the changes to what callers send. GitLab's response @@ -64,6 +68,12 @@ type Plugin struct { // Diff adapts the differ to the spec's conventions. The zero value is // right for Stripe's. Diff diff.Options + // RemovalsNeedANewVersion drops operation removals between two specs of + // the same version: for an API whose spec is fixed up on a release + // branch after the release, where a removal there is a correction to the + // spec, not a release removing an API (Elasticsearch removes APIs in a + // new minor or major, never in a patch). + RemovalsNeedANewVersion bool } func (p Plugin) Name() string { return p.Adapter.API() } @@ -184,6 +194,18 @@ func (p Plugin) events(oldParsed, newParsed *diff.Spec, oldContent, newContent [ } changes = kept } + if p.RemovalsNeedANewVersion && src.Version == src.PreviousVersion { + kept := changes[:0:0] + for _, c := range changes { + if c.Kind != diff.OperationRemoved { + kept = append(kept, c) + } + } + if dropped := len(changes) - len(kept); dropped > 0 { + log.Printf("%s %s: %d removals dropped: same version as the last spec", src.API, src.Version, dropped) + } + changes = kept + } events, errs := normalize.Events(changes, src) rp, ok := p.Adapter.(adapter.Reshaper) if !ok || len(events) == 0 { diff --git a/plugins/openapi/registered_test.go b/plugins/openapi/registered_test.go index 3232214..bb2992a 100644 --- a/plugins/openapi/registered_test.go +++ b/plugins/openapi/registered_test.go @@ -8,7 +8,7 @@ import ( ) func TestRegistersItself(t *testing.T) { - for _, a := range []adapter.Adapter{adapter.Stripe{}, adapter.Datadog{}, adapter.GitLab{}, adapter.GitHub{}, adapter.Vercel{}, adapter.Supabase{}, adapter.Algolia{Spec: "search"}, adapter.Algolia{Spec: "ingestion"}, adapter.Algolia{Spec: "recommend"}} { + for _, a := range []adapter.Adapter{adapter.Stripe{}, adapter.Datadog{}, adapter.GitLab{}, adapter.GitHub{}, adapter.Vercel{}, adapter.Supabase{}, adapter.Algolia{Spec: "search"}, adapter.Algolia{Spec: "ingestion"}, adapter.Algolia{Spec: "recommend"}, adapter.Elasticsearch{}} { kittest.Registered(t, Plugin{Adapter: a}) } } diff --git a/plugins/openapi/testdata/README.md b/plugins/openapi/testdata/README.md index a93996e..43e5c39 100644 --- a/plugins/openapi/testdata/README.md +++ b/plugins/openapi/testdata/README.md @@ -19,6 +19,10 @@ Each pair is a real breaking change between two releases of a provider's own spe | `algolia-ingestion-2025-01-07-d0417f325.yml`, `algolia-ingestion-2025-01-22-232affcac.yml` | https://raw.githubusercontent.com/algolia/api-clients-automation/released-2025-01-07-d0417f325/specs/bundled/ingestion.yml (and `released-2025-01-22-232affcac`) | 2026-11-19 | MIT (algolia/api-clients-automation) | "Retrieves a list of tasks using the v1 endpoint, please use `getTasks` instead." (`GET /1/tasks`) | | `algolia-recommend-2024-03-19-2eac6f410.yml`, `algolia-recommend-2024-03-25-30207fcd0.yml` | https://raw.githubusercontent.com/algolia/api-clients-automation/released-2024-03-19-2eac6f410/specs/bundled/recommend.yml (and `released-2024-03-25-30207fcd0`) | 2026-11-19 | MIT (algolia/api-clients-automation) | `/1{path}:` (in `2024-03-19`), `/{path}:` (in `2024-03-25`): `algolia-recommend`'s drop test | | `algolia-ingestion-2024-09-18-cc190fae3.yml`, `algolia-ingestion-2024-09-19-a62c27d3b.yml` | https://raw.githubusercontent.com/algolia/api-clients-automation/released-2024-09-18-cc190fae3/specs/bundled/ingestion.yml (and `released-2024-09-19-a62c27d3b`) | 2026-11-19 | MIT (algolia/api-clients-automation) | `/1/transformations/models:` (in `2024-09-18`, never deprecated, gone in `2024-09-19`): the drop test | +| `elasticsearch-8.19-fd5d063c.json`, `elasticsearch-9.0-57ecfe5f.json` | https://raw.githubusercontent.com/elastic/elasticsearch-specification/fd5d063c4824de5d33618b7fca4df0e6c1b8489f/output/openapi/elasticsearch-openapi.json (the head of `8.19`; and `57ecfe5fda6976b94fc8b8830ecb51f4969dccd6`, the head of `9.0`) | 2026-11-19 | Apache-2.0 (elastic/elasticsearch-specification) | `"/{index}/_unfreeze": {` (in 8.19, deprecated; gone in 9.0) | +| `elasticsearch-9.1-12639d0e.json`, `elasticsearch-9.2-87a82640.json` | https://raw.githubusercontent.com/elastic/elasticsearch-specification/12639d0e5ec07f064c909f15160ff68d608dbc2c/output/openapi/elasticsearch-openapi.json (the head of `9.1`; and `87a82640d8aa1139163dc7071bf00f971ce5e453`, the head of `9.2`) | 2026-11-19 | Apache-2.0 (elastic/elasticsearch-specification) | "designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported." (`/_autoscaling/capacity`, in 9.1, gone in 9.2): the drop test | + +The Elasticsearch copies keep `openapi`, `info` and the paths involved, every line unchanged; the 9.2 copy's paths are all gone in 9.2, so its `"paths": {}` is the one line that isn't in the original. The Algolia copies are trimmed by lines: `openapi`, `info` and the paths involved, every line copied unchanged; `components` left out. diff --git a/plugins/openapi/testdata/elasticsearch-8.19-fd5d063c.json b/plugins/openapi/testdata/elasticsearch-8.19-fd5d063c.json new file mode 100644 index 0000000..0580f7f --- /dev/null +++ b/plugins/openapi/testdata/elasticsearch-8.19-fd5d063c.json @@ -0,0 +1,718 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Elasticsearch Request & Response Specification", + "license": { + "name": "Apache 2.0", + "url": "https://github.com/elastic/elasticsearch-specification/blob/main/LICENSE" + }, + "version": "" + }, + "paths": { + "/_data_stream/{name}/_options": { + "get": { + "tags": [ + "data stream" + ], + "summary": "Get data stream options", + "description": "Get the data stream options configuration of one or more data streams.", + "operationId": "indices-get-data-stream-options", + "parameters": [ + { + "in": "path", + "name": "name", + "description": "Comma-separated list of data streams to limit the request.\nSupports wildcards (`*`).\nTo target all data streams, omit this parameter or use `*` or `_all`.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.DataStreamNames" + }, + "style": "simple" + }, + { + "in": "query", + "name": "expand_wildcards", + "description": "Type of data stream that wildcard patterns can match.\nSupports comma-separated values, such as `open,hidden`.\nValid values are: `all`, `open`, `closed`, `hidden`, `none`.", + "deprecated": false, + "schema": { + "default": "open", + "allOf": [ + { + "$ref": "#/components/schemas/_types.ExpandWildcards" + } + ] + }, + "style": "form" + }, + { + "in": "query", + "name": "master_timeout", + "description": "Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "default": "30s", + "allOf": [ + { + "$ref": "#/components/schemas/_types.Duration" + } + ] + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data_streams": { + "type": "array", + "items": { + "$ref": "#/components/schemas/indices.get_data_stream_options.DataStreamWithOptions" + } + } + }, + "required": [ + "data_streams" + ] + } + } + } + } + }, + "x-state": "Generally available; Added in 8.19.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + }, + "put": { + "tags": [ + "data stream" + ], + "summary": "Update data stream options", + "description": "Update the data stream options of the specified data streams.", + "operationId": "indices-put-data-stream-options", + "parameters": [ + { + "in": "path", + "name": "name", + "description": "Comma-separated list of data streams used to limit the request.\nSupports wildcards (`*`).\nTo target all data streams use `*` or `_all`.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.DataStreamNames" + }, + "style": "simple" + }, + { + "in": "query", + "name": "expand_wildcards", + "description": "Type of data stream that wildcard patterns can match.\nSupports comma-separated values, such as `open,hidden`.\nValid values are: `all`, `hidden`, `open`, `closed`, `none`.", + "deprecated": false, + "schema": { + "default": "open", + "allOf": [ + { + "$ref": "#/components/schemas/_types.ExpandWildcards" + } + ] + }, + "style": "form" + }, + { + "in": "query", + "name": "master_timeout", + "description": "Period to wait for a connection to the master node. If no response is\nreceived before the timeout expires, the request fails and returns an\nerror.", + "deprecated": false, + "schema": { + "default": "30s", + "allOf": [ + { + "$ref": "#/components/schemas/_types.Duration" + } + ] + }, + "style": "form" + }, + { + "in": "query", + "name": "timeout", + "description": "Period to wait for a response.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "default": "30s", + "allOf": [ + { + "$ref": "#/components/schemas/_types.Duration" + } + ] + }, + "style": "form" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "failure_store": { + "description": "If defined, it will update the failure store configuration of every data stream resolved by the name expression.", + "allOf": [ + { + "$ref": "#/components/schemas/indices._types.DataStreamFailureStore" + } + ] + } + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/_types.AcknowledgedResponseBase" + } + } + } + } + }, + "x-state": "Generally available; Added in 8.19.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + }, + "delete": { + "tags": [ + "data stream" + ], + "summary": "Delete data stream options", + "description": "Removes the data stream options from a data stream.", + "operationId": "indices-delete-data-stream-options", + "parameters": [ + { + "in": "path", + "name": "name", + "description": "A comma-separated list of data streams of which the data stream options will be deleted.\nUse `*` to get all data streams", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.DataStreamNames" + }, + "style": "simple" + }, + { + "in": "query", + "name": "expand_wildcards", + "description": "Whether wildcard expressions should get expanded to open or closed indices", + "deprecated": false, + "schema": { + "default": "open", + "allOf": [ + { + "$ref": "#/components/schemas/_types.ExpandWildcards" + } + ] + }, + "style": "form" + }, + { + "in": "query", + "name": "master_timeout", + "description": "The period to wait for a connection to the master node.", + "deprecated": false, + "schema": { + "default": "30s", + "allOf": [ + { + "$ref": "#/components/schemas/_types.Duration" + } + ] + }, + "style": "form" + }, + { + "in": "query", + "name": "timeout", + "description": "The period to wait for a response.", + "deprecated": false, + "schema": { + "default": "30s", + "allOf": [ + { + "$ref": "#/components/schemas/_types.Duration" + } + ] + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/_types.AcknowledgedResponseBase" + }, + "examples": { + "IndicesDeleteDataStreamOptionsResponseExample1": { + "description": "A successful response for deleting data stream options.", + "value": "{\n \"acknowledged\": true\n}" + } + } + } + } + } + }, + "x-state": "Generally available; Added in 8.19.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + } + }, + "/{index}/_unfreeze": { + "post": { + "tags": [ + "indices" + ], + "summary": "Unfreeze an index", + "description": "When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again.\n\n## Required authorization\n\n* Index privileges: `manage`\n", + "operationId": "indices-unfreeze", + "parameters": [ + { + "in": "path", + "name": "index", + "description": "Identifier for the index.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.IndexName" + }, + "style": "simple" + }, + { + "in": "query", + "name": "allow_no_indices", + "description": "If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices.\nThis behavior applies even if the request targets other open indices.", + "deprecated": false, + "schema": { + "default": true, + "type": "boolean" + }, + "style": "form" + }, + { + "in": "query", + "name": "expand_wildcards", + "description": "Type of index that wildcard patterns can match.\nIf the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.\nSupports comma-separated values, such as `open,hidden`.\nValid values are: `all`, `open`, `closed`, `hidden`, `none`.", + "deprecated": false, + "schema": { + "default": "open", + "allOf": [ + { + "$ref": "#/components/schemas/_types.ExpandWildcards" + } + ] + }, + "style": "form" + }, + { + "in": "query", + "name": "ignore_unavailable", + "description": "If `false`, the request returns an error if it targets a missing or closed index.", + "deprecated": false, + "schema": { + "default": false, + "type": "boolean" + }, + "style": "form" + }, + { + "in": "query", + "name": "master_timeout", + "description": "Period to wait for a connection to the master node.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "default": "30s", + "allOf": [ + { + "$ref": "#/components/schemas/_types.Duration" + } + ] + }, + "style": "form" + }, + { + "in": "query", + "name": "timeout", + "description": "Period to wait for a response.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "default": "30s", + "allOf": [ + { + "$ref": "#/components/schemas/_types.Duration" + } + ] + }, + "style": "form" + }, + { + "in": "query", + "name": "wait_for_active_shards", + "description": "The number of shard copies that must be active before proceeding with the operation.\nSet to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).", + "deprecated": false, + "schema": { + "default": "1", + "type": "string" + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "acknowledged": { + "type": "boolean" + }, + "shards_acknowledged": { + "type": "boolean" + } + }, + "required": [ + "acknowledged", + "shards_acknowledged" + ] + } + } + } + } + }, + "deprecated": true, + "x-state": "Generally available; Added in 6.6.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + } + }, + "/{index}/_knn_search": { + "get": { + "tags": [ + "search" + ], + "summary": "Run a knn search", + "description": "NOTE: The kNN search API has been replaced by the `knn` option in the search API.\n\nPerform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents.\nGiven a query vector, the API finds the k closest vectors and returns those documents as search hits.\n\nElasticsearch uses the HNSW algorithm to support efficient kNN search.\nLike most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed.\nThis means the results returned are not always the true k closest neighbors.\n\nThe kNN search API supports restricting the search using a filter.\nThe search will return the top k documents that also match the filter query.\n\nA kNN search response has the exact same structure as a search API response.\nHowever, certain sections have a meaning specific to kNN search:\n\n* The document `_score` is determined by the similarity between the query and document vector.\n* The `hits.total` object contains the total number of nearest neighbor candidates considered, which is `num_candidates * num_shards`. The `hits.total.relation` will always be `eq`, indicating an exact value.", + "operationId": "knn-search", + "parameters": [ + { + "$ref": "#/components/parameters/knn_search-index" + }, + { + "$ref": "#/components/parameters/knn_search-routing" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/knn_search" + }, + "responses": { + "200": { + "$ref": "#/components/responses/knn_search-200" + } + }, + "deprecated": true, + "x-state": "Technical preview; Added in 8.0.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + }, + "post": { + "tags": [ + "search" + ], + "summary": "Run a knn search", + "description": "NOTE: The kNN search API has been replaced by the `knn` option in the search API.\n\nPerform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents.\nGiven a query vector, the API finds the k closest vectors and returns those documents as search hits.\n\nElasticsearch uses the HNSW algorithm to support efficient kNN search.\nLike most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed.\nThis means the results returned are not always the true k closest neighbors.\n\nThe kNN search API supports restricting the search using a filter.\nThe search will return the top k documents that also match the filter query.\n\nA kNN search response has the exact same structure as a search API response.\nHowever, certain sections have a meaning specific to kNN search:\n\n* The document `_score` is determined by the similarity between the query and document vector.\n* The `hits.total` object contains the total number of nearest neighbor candidates considered, which is `num_candidates * num_shards`. The `hits.total.relation` will always be `eq`, indicating an exact value.", + "operationId": "knn-search-1", + "parameters": [ + { + "$ref": "#/components/parameters/knn_search-index" + }, + { + "$ref": "#/components/parameters/knn_search-routing" + } + ], + "requestBody": { + "$ref": "#/components/requestBodies/knn_search" + }, + "responses": { + "200": { + "$ref": "#/components/responses/knn_search-200" + } + }, + "deprecated": true, + "x-state": "Technical preview; Added in 8.0.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + } + }, + "/_application/analytics/{name}": { + "get": { + "tags": [ + "analytics" + ], + "summary": "Get behavioral analytics collections", + "operationId": "search-application-get-behavioral-analytics-1", + "parameters": [ + { + "$ref": "#/components/parameters/search_application.get_behavioral_analytics-name" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/search_application.get_behavioral_analytics-200" + } + }, + "x-state": "Technical preview; Added in 8.8.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + }, + "put": { + "tags": [ + "analytics" + ], + "summary": "Create a behavioral analytics collection", + "operationId": "search-application-put-behavioral-analytics", + "parameters": [ + { + "in": "path", + "name": "name", + "description": "The name of the analytics collection to be created or updated.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Name" + }, + "style": "simple" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/search_application.put_behavioral_analytics.AnalyticsAcknowledgeResponseBase" + } + } + } + } + }, + "x-state": "Technical preview; Added in 8.8.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + }, + "delete": { + "tags": [ + "analytics" + ], + "summary": "Delete a behavioral analytics collection", + "description": "The associated data stream is also deleted.", + "operationId": "search-application-delete-behavioral-analytics", + "parameters": [ + { + "in": "path", + "name": "name", + "description": "The name of the analytics collection to be deleted", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Name" + }, + "style": "simple" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/_types.AcknowledgedResponseBase" + } + } + } + } + }, + "x-state": "Technical preview; Added in 8.8.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + } + }, + "/_application/analytics": { + "get": { + "tags": [ + "analytics" + ], + "summary": "Get behavioral analytics collections", + "operationId": "search-application-get-behavioral-analytics", + "responses": { + "200": { + "$ref": "#/components/responses/search_application.get_behavioral_analytics-200" + } + }, + "x-state": "Technical preview; Added in 8.8.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + } + }, + "/_application/analytics/{collection_name}/event/{event_type}": { + "post": { + "tags": [ + "analytics" + ], + "summary": "Create a behavioral analytics collection event", + "externalDocs": { + "url": "https://www.elastic.co/guide/en/elasticsearch/reference/8.19/behavioral-analytics-event-reference.html" + }, + "operationId": "search-application-post-behavioral-analytics-event", + "parameters": [ + { + "in": "path", + "name": "collection_name", + "description": "The name of the behavioral analytics collection.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Name" + }, + "style": "simple" + }, + { + "in": "path", + "name": "event_type", + "description": "The analytics event type.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/search_application._types.EventType" + }, + "style": "simple" + }, + { + "in": "query", + "name": "debug", + "description": "Whether the response type has to include more details", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "examples": { + "BehavioralAnalyticsEventPostRequestExample1": { + "description": "Run `POST _application/analytics/my_analytics_collection/event/search_click` to send a `search_click` event to an analytics collection called `my_analytics_collection`.", + "value": "{\n \"session\": {\n \"id\": \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"\n },\n \"user\": {\n \"id\": \"5f26f01a-bbee-4202-9298-81261067abbd\"\n },\n \"search\":{\n \"query\": \"search term\",\n \"results\": {\n \"items\": [\n {\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n }\n ],\n \"total_results\": 10\n },\n \"sort\": {\n \"name\": \"relevance\"\n },\n \"search_application\": \"website\"\n },\n \"document\":{\n \"id\": \"123\",\n \"index\": \"products\"\n }\n}" + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "accepted": { + "type": "boolean" + }, + "event": { + "type": "object" + } + }, + "required": [ + "accepted" + ] + } + } + } + }, + "202": { + "description": "\nEvent has been accepted and will be ingested." + }, + "400": { + "description": "\nEither the event type is unknown or the event payload contains invalid data." + }, + "404": { + "description": "\nAnalytics collection does not exist." + } + }, + "x-state": "Technical preview", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + } + } + } +} diff --git a/plugins/openapi/testdata/elasticsearch-9.0-57ecfe5f.json b/plugins/openapi/testdata/elasticsearch-9.0-57ecfe5f.json new file mode 100644 index 0000000..e45e40c --- /dev/null +++ b/plugins/openapi/testdata/elasticsearch-9.0-57ecfe5f.json @@ -0,0 +1,237 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Elasticsearch Request & Response Specification", + "license": { + "name": "Apache 2.0", + "url": "https://github.com/elastic/elasticsearch-specification/blob/main/LICENSE" + }, + "version": "" + }, + "paths": { + "/_application/analytics/{name}": { + "get": { + "tags": [ + "analytics" + ], + "summary": "Get behavioral analytics collections", + "operationId": "search-application-get-behavioral-analytics-1", + "parameters": [ + { + "$ref": "#/components/parameters/search_application.get_behavioral_analytics-name" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/search_application.get_behavioral_analytics-200" + } + }, + "deprecated": true, + "x-state": "Technical preview; Added in 8.8.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + }, + "put": { + "tags": [ + "analytics" + ], + "summary": "Create a behavioral analytics collection", + "operationId": "search-application-put-behavioral-analytics", + "parameters": [ + { + "in": "path", + "name": "name", + "description": "The name of the analytics collection to be created or updated.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Name" + }, + "style": "simple" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/search_application.put_behavioral_analytics.AnalyticsAcknowledgeResponseBase" + } + } + } + } + }, + "deprecated": true, + "x-state": "Technical preview; Added in 8.8.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + }, + "delete": { + "tags": [ + "analytics" + ], + "summary": "Delete a behavioral analytics collection", + "description": "The associated data stream is also deleted.", + "operationId": "search-application-delete-behavioral-analytics", + "parameters": [ + { + "in": "path", + "name": "name", + "description": "The name of the analytics collection to be deleted", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Name" + }, + "style": "simple" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/_types.AcknowledgedResponseBase" + } + } + } + } + }, + "deprecated": true, + "x-state": "Technical preview; Added in 8.8.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + } + }, + "/_application/analytics": { + "get": { + "tags": [ + "analytics" + ], + "summary": "Get behavioral analytics collections", + "operationId": "search-application-get-behavioral-analytics", + "responses": { + "200": { + "$ref": "#/components/responses/search_application.get_behavioral_analytics-200" + } + }, + "deprecated": true, + "x-state": "Technical preview; Added in 8.8.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + } + }, + "/_application/analytics/{collection_name}/event/{event_type}": { + "post": { + "tags": [ + "analytics" + ], + "summary": "Create a behavioral analytics collection event", + "externalDocs": { + "url": "https://www.elastic.co/guide/en/elasticsearch/reference/8.18/behavioral-analytics-event-reference.html", + "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.18/post-analytics-collection-event.html" + }, + "operationId": "search-application-post-behavioral-analytics-event", + "parameters": [ + { + "in": "path", + "name": "collection_name", + "description": "The name of the behavioral analytics collection.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Name" + }, + "style": "simple" + }, + { + "in": "path", + "name": "event_type", + "description": "The analytics event type.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/search_application._types.EventType" + }, + "style": "simple" + }, + { + "in": "query", + "name": "debug", + "description": "Whether the response type has to include more details", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "examples": { + "BehavioralAnalyticsEventPostRequestExample1": { + "description": "Run `POST _application/analytics/my_analytics_collection/event/search_click` to send a `search_click` event to an analytics collection called `my_analytics_collection`.", + "value": "{\n \"session\": {\n \"id\": \"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\"\n },\n \"user\": {\n \"id\": \"5f26f01a-bbee-4202-9298-81261067abbd\"\n },\n \"search\":{\n \"query\": \"search term\",\n \"results\": {\n \"items\": [\n {\n \"document\": {\n \"id\": \"123\",\n \"index\": \"products\"\n }\n }\n ],\n \"total_results\": 10\n },\n \"sort\": {\n \"name\": \"relevance\"\n },\n \"search_application\": \"website\"\n },\n \"document\":{\n \"id\": \"123\",\n \"index\": \"products\"\n }\n}" + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "accepted": { + "type": "boolean" + }, + "event": { + "type": "object" + } + }, + "required": [ + "accepted" + ] + } + } + } + } + }, + "deprecated": true, + "x-state": "Technical preview", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + } + } + } +} diff --git a/plugins/openapi/testdata/elasticsearch-9.1-12639d0e.json b/plugins/openapi/testdata/elasticsearch-9.1-12639d0e.json new file mode 100644 index 0000000..4ecd56a --- /dev/null +++ b/plugins/openapi/testdata/elasticsearch-9.1-12639d0e.json @@ -0,0 +1,526 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Elasticsearch Request & Response Specification", + "license": { + "name": "Apache 2.0", + "url": "https://github.com/elastic/elasticsearch-specification/blob/main/LICENSE" + }, + "version": "" + }, + "paths": { + "/_autoscaling/policy/{name}": { + "get": { + "tags": [ + "autoscaling" + ], + "summary": "Get an autoscaling policy", + "description": "NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.", + "externalDocs": { + "url": "https://www.elastic.co/docs/deploy-manage/autoscaling", + "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.18/autoscaling-get-autoscaling-capacity.html" + }, + "operationId": "autoscaling-get-autoscaling-policy", + "parameters": [ + { + "in": "path", + "name": "name", + "description": "Name of the autoscaling policy", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Name" + }, + "style": "simple" + }, + { + "in": "query", + "name": "master_timeout", + "description": "Period to wait for a connection to the master node.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/autoscaling._types.AutoscalingPolicy" + }, + "examples": { + "GetAutoscalingPolicyResponseExample1": { + "summary": "A successful response for retrieving an autoscaling policy.", + "description": "This may be a response to `GET /_autoscaling/policy/my_autoscaling_policy`.", + "value": "{\n \"roles\": ,\n \"deciders\": \n}" + } + } + } + } + } + }, + "x-state": "Generally available; Added in 7.11.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + }, + "put": { + "tags": [ + "autoscaling" + ], + "summary": "Create or update an autoscaling policy", + "description": "NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.", + "externalDocs": { + "url": "https://www.elastic.co/docs/deploy-manage/autoscaling", + "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.18/autoscaling-put-autoscaling-policy.html" + }, + "operationId": "autoscaling-put-autoscaling-policy", + "parameters": [ + { + "in": "path", + "name": "name", + "description": "Name of the autoscaling policy", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Name" + }, + "style": "simple" + }, + { + "in": "query", + "name": "master_timeout", + "description": "Period to wait for a connection to the master node.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + }, + { + "in": "query", + "name": "timeout", + "description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/autoscaling._types.AutoscalingPolicy" + }, + "examples": { + "PutAutoscalingPolicyRequestExample1": { + "summary": "Creates or updates an autoscaling policy.", + "value": "{\n \"roles\": [],\n \"deciders\": {\n \"fixed\": {\n }\n }\n}" + }, + "PutAutoscalingPolicyRequestExample2": { + "summary": "Creates an autoscaling policy.", + "description": "The API method and path for this request: `PUT /_autoscaling/policy/my_autoscaling_policy`. It creates `my_autoscaling_policy` using the fixed autoscaling decider, applying to the set of nodes having (only) the `data_hot` role.", + "value": "{\n \"roles\" : [ \"data_hot\" ],\n \"deciders\": {\n \"fixed\": {\n }\n }\n}" + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/_types.AcknowledgedResponseBase" + }, + "examples": { + "PutAutoscalingPolicyResponseExample1": { + "summary": "A successful response when creating an autoscaling policy.", + "value": "{\n \"acknowledged\": true\n}" + } + } + } + } + } + }, + "x-state": "Generally available; Added in 7.11.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + }, + "delete": { + "tags": [ + "autoscaling" + ], + "summary": "Delete an autoscaling policy", + "description": "NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.", + "externalDocs": { + "url": "https://www.elastic.co/docs/deploy-manage/autoscaling", + "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.18/autoscaling-delete-autoscaling-policy.html" + }, + "operationId": "autoscaling-delete-autoscaling-policy", + "parameters": [ + { + "in": "path", + "name": "name", + "description": "Name of the autoscaling policy", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Name" + }, + "style": "simple" + }, + { + "in": "query", + "name": "master_timeout", + "description": "Period to wait for a connection to the master node.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + }, + { + "in": "query", + "name": "timeout", + "description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/_types.AcknowledgedResponseBase" + }, + "examples": { + "DeleteAutoscalingPolicyResponseExample1": { + "summary": "A successful response of deleting one or more autoscaling policy.", + "description": "This may be a response to either `DELETE /_autoscaling/policy/my_autoscaling_policy` or `DELETE /_autoscaling/policy/*`.\n", + "value": "{\n \"acknowledged\": true\n}" + } + } + } + } + } + }, + "x-state": "Generally available; Added in 7.11.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + } + }, + "/_autoscaling/capacity": { + "get": { + "tags": [ + "autoscaling" + ], + "summary": "Get the autoscaling capacity", + "description": "NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.\n\nThis API gets the current autoscaling capacity based on the configured autoscaling policy.\nIt will return information to size the cluster appropriately to the current workload.\n\nThe `required_capacity` is calculated as the maximum of the `required_capacity` result of all individual deciders that are enabled for the policy.\n\nThe operator should verify that the `current_nodes` match the operator’s knowledge of the cluster to avoid making autoscaling decisions based on stale or incomplete information.\n\nThe response contains decider-specific information you can use to diagnose how and why autoscaling determined a certain capacity was required.\nThis information is provided for diagnosis only.\nDo not use this information to make autoscaling decisions.", + "externalDocs": { + "url": "https://www.elastic.co/docs/deploy-manage/autoscaling", + "x-previousVersionUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.18/autoscaling-get-autoscaling-capacity.html" + }, + "operationId": "autoscaling-get-autoscaling-capacity", + "parameters": [ + { + "in": "query", + "name": "master_timeout", + "description": "Period to wait for a connection to the master node.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "policies": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/autoscaling.get_autoscaling_capacity.AutoscalingDeciders" + } + } + }, + "required": [ + "policies" + ] + }, + "examples": { + "GetAutoscalingCapacityResponseExample1": { + "summary": "A successful response for retrieving the current autoscaling capacity.", + "description": "This may be a response to `GET /_autoscaling/capacity`.", + "value": "{\n policies: {}\n}" + } + } + } + } + } + }, + "x-state": "Generally available; Added in 7.11.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + } + }, + "/_nodes/{node_id}/shutdown": { + "get": { + "tags": [ + "shutdown" + ], + "summary": "Get the shutdown status", + "description": "Get information about nodes that are ready to be shut down, have shut down preparations still in progress, or have stalled.\nThe API returns status information for each part of the shut down process.\n\nNOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.\n\nIf the operator privileges feature is enabled, you must be an operator to use this API.\n\n## Required authorization\n\n* Cluster privileges: `manage`\n", + "operationId": "shutdown-get-node-1", + "parameters": [ + { + "$ref": "#/components/parameters/shutdown.get_node-node_id" + }, + { + "$ref": "#/components/parameters/shutdown.get_node-master_timeout" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/shutdown.get_node-200" + } + }, + "x-state": "Generally available; Added in 7.13.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + }, + "put": { + "tags": [ + "shutdown" + ], + "summary": "Prepare a node to be shut down", + "description": "NOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.\n\nIf you specify a node that is offline, it will be prepared for shut down when it rejoins the cluster.\n\nIf the operator privileges feature is enabled, you must be an operator to use this API.\n\nThe API migrates ongoing tasks and index shards to other nodes as needed to prepare a node to be restarted or shut down and removed from the cluster.\nThis ensures that Elasticsearch can be stopped safely with minimal disruption to the cluster.\n\nYou must specify the type of shutdown: `restart`, `remove`, or `replace`.\nIf a node is already being prepared for shutdown, you can use this API to change the shutdown type.\n\nIMPORTANT: This API does NOT terminate the Elasticsearch process.\nMonitor the node shutdown status to determine when it is safe to stop Elasticsearch.\n\n## Required authorization\n\n* Cluster privileges: `manage`\n", + "operationId": "shutdown-put-node", + "parameters": [ + { + "in": "path", + "name": "node_id", + "description": "The node identifier.\nThis parameter is not validated against the cluster's active nodes.\nThis enables you to register a node for shut down while it is offline.\nNo error is thrown if you specify an invalid node ID.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.NodeId" + }, + "style": "simple" + }, + { + "in": "query", + "name": "master_timeout", + "description": "The period to wait for a connection to the master node.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + }, + { + "in": "query", + "name": "timeout", + "description": "The period to wait for a response.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "type": { + "description": "Valid values are restart, remove, or replace.\nUse restart when you need to temporarily shut down a node to perform an upgrade, make configuration changes, or perform other maintenance.\nBecause the node is expected to rejoin the cluster, data is not migrated off of the node.\nUse remove when you need to permanently remove a node from the cluster.\nThe node is not marked ready for shutdown until data is migrated off of the node Use replace to do a 1:1 replacement of a node with another node.\nCertain allocation decisions will be ignored (such as disk watermarks) in the interest of true replacement of the source node with the target node.\nDuring a replace-type shutdown, rollover and index creation may result in unassigned shards, and shrink may fail until the replacement is complete.", + "allOf": [ + { + "$ref": "#/components/schemas/shutdown._types.Type" + } + ] + }, + "reason": { + "description": "A human-readable reason that the node is being shut down.\nThis field provides information for other cluster operators; it does not affect the shut down process.", + "type": "string" + }, + "allocation_delay": { + "description": "Only valid if type is restart.\nControls how long Elasticsearch will wait for the node to restart and join the cluster before reassigning its shards to other nodes.\nThis works the same as delaying allocation with the index.unassigned.node_left.delayed_timeout setting.\nIf you specify both a restart allocation delay and an index-level allocation delay, the longer of the two is used.", + "type": "string" + }, + "target_node_name": { + "description": "Only valid if type is replace.\nSpecifies the name of the node that is replacing the node being shut down.\nShards from the shut down node are only allowed to be allocated to the target node, and no other data will be allocated to the target node.\nDuring relocation of data certain allocation rules are ignored, such as disk watermarks or user attribute filtering rules.", + "type": "string" + } + }, + "required": [ + "type", + "reason" + ] + }, + "examples": { + "ShutdownPutNodeRequestExample1": { + "description": "Register a node for shutdown with `PUT /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown`. The `restart` type prepares the node to be restarted.\n", + "value": "{\n \"type\": \"restart\",\n \"reason\": \"Demonstrating how the node shutdown API works\",\n \"allocation_delay\": \"20m\"\n}" + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/_types.AcknowledgedResponseBase" + } + } + } + } + }, + "x-state": "Generally available; Added in 7.13.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + }, + "delete": { + "tags": [ + "shutdown" + ], + "summary": "Cancel node shutdown preparations", + "description": "Remove a node from the shutdown list so it can resume normal operations.\nYou must explicitly clear the shutdown request when a node rejoins the cluster or when a node has permanently left the cluster.\nShutdown requests are never removed automatically by Elasticsearch.\n\nNOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes.\nDirect use is not supported.\n\nIf the operator privileges feature is enabled, you must be an operator to use this API.\n\n## Required authorization\n\n* Cluster privileges: `manage`\n", + "operationId": "shutdown-delete-node", + "parameters": [ + { + "in": "path", + "name": "node_id", + "description": "The node id of node to be removed from the shutdown state", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.NodeId" + }, + "style": "simple" + }, + { + "in": "query", + "name": "master_timeout", + "description": "Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + }, + { + "in": "query", + "name": "timeout", + "description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Duration" + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/_types.AcknowledgedResponseBase" + }, + "examples": { + "ShutdownDeleteNodeResponseExample1": { + "description": "A successful response from `DELETE /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown`.", + "value": "{\n \"acknowledged\": true\n}" + } + } + } + } + } + }, + "x-state": "Generally available; Added in 7.13.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + } + }, + "/_nodes/shutdown": { + "get": { + "tags": [ + "shutdown" + ], + "summary": "Get the shutdown status", + "description": "Get information about nodes that are ready to be shut down, have shut down preparations still in progress, or have stalled.\nThe API returns status information for each part of the shut down process.\n\nNOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.\n\nIf the operator privileges feature is enabled, you must be an operator to use this API.\n\n## Required authorization\n\n* Cluster privileges: `manage`\n", + "operationId": "shutdown-get-node", + "parameters": [ + { + "$ref": "#/components/parameters/shutdown.get_node-master_timeout" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/shutdown.get_node-200" + } + }, + "x-state": "Generally available; Added in 7.13.0", + "x-metaTags": [ + { + "content": "Elasticsearch", + "name": "product_name" + } + ] + } + } + } +} diff --git a/plugins/openapi/testdata/elasticsearch-9.2-87a82640.json b/plugins/openapi/testdata/elasticsearch-9.2-87a82640.json new file mode 100644 index 0000000..d0970b2 --- /dev/null +++ b/plugins/openapi/testdata/elasticsearch-9.2-87a82640.json @@ -0,0 +1,12 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Elasticsearch Request & Response Specification", + "license": { + "name": "Apache 2.0", + "url": "https://github.com/elastic/elasticsearch-specification/blob/main/LICENSE" + }, + "version": "" + }, + "paths": {} +} diff --git a/plugins/openapi/testdata/golden/elasticsearch.json b/plugins/openapi/testdata/golden/elasticsearch.json new file mode 100644 index 0000000..33941d9 --- /dev/null +++ b/plugins/openapi/testdata/golden/elasticsearch.json @@ -0,0 +1,170 @@ +[ + { + "id": 1, + "fingerprint": "sha256:e6f9a24b6c0707867db8194dcf23dd20fe851e359236a9567c741e60daa220af", + "api": "elasticsearch", + "version": "9.0.0", + "previous_version": "8.19.0", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "GET /_application/analytics" + }, + "description": "Operation GET /_application/analytics marked deprecated.", + "source_url": "https://raw.githubusercontent.com/elastic/elasticsearch-specification/57ecfe5fda6976b94fc8b8830ecb51f4969dccd6/output/openapi/elasticsearch-openapi.json", + "source_pointer": "/paths/~1_application~1analytics/get", + "source_excerpt": "{\"deprecated\":true,\"operationId\":\"search-application-get-behavioral-analytics\",\"responses\":{\"200\":{\"$ref\":\"#/components/responses/search_application.get_behavioral_analytics-200\"}},\"summary\":\"Get behavioral analytics collections\",\"tags\":[\"analytics\"],\"x-metaTags\":[{\"content\":\"Elasticsearch\",\"name\":\"product_name\"}],\"x-state\":\"Technical preview; Added in 8.8.0\"}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 2, + "fingerprint": "sha256:914a686914eb233286a5ea281f284296892936c059d663d7786bf7972c3e6ae8", + "api": "elasticsearch", + "version": "9.0.0", + "previous_version": "8.19.0", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "POST /_application/analytics/{collection_name}/event/{event_type}" + }, + "description": "Operation POST /_application/analytics/{collection_name}/event/{event_type} marked deprecated.", + "source_url": "https://raw.githubusercontent.com/elastic/elasticsearch-specification/57ecfe5fda6976b94fc8b8830ecb51f4969dccd6/output/openapi/elasticsearch-openapi.json", + "source_pointer": "/paths/~1_application~1analytics~1{collection_name}~1event~1{event_type}/post", + "source_excerpt": "{\"deprecated\":true,\"externalDocs\":{\"url\":\"https://www.elastic.co/guide/en/elasticsearch/reference/8.18/behavioral-analytics-event-reference.html\",\"x-previousVersionUrl\":\"https://www.elastic.co/guide/en/elasticsearch/reference/8.18/post-analytics-collection-event.html\"},\"operationId\":\"search-application-post-behavioral-analytics-event\",\"parameters\":[{\"deprecated\":false,\"description\":\"The name of the behavioral analytics collection.\",\"in\":\"path\",\"name\":\"collection_name\",\"required\":true,\"schema\":{\"$ref\":\"#/components/schemas/_types.Name\"},\"style\":\"simple\"},{\"deprecated\":false,\"description\":\"The analytics event type.\",\"in\":\"path\",\"name\":\"event_type\",\"required\":true,\"schema\":{\"$ref\":\"#/components/schemas/search_application._types.EventType\"},\"style\":\"simple\"},{\"deprecated\":false,\"description\":\"Whether the response type has to include more details\",\"in\":\"query\",\"name\":\"debug\",\"schema\":{\"type\":\"boolean\"},\"style\":\"form\"}],\"requestBody\":{\"content\":{\"application/json\":{\"examples\":{\"BehavioralAnalyticsEventPostRequestExample1\":{\"description\":\"Run `POST _application/analytics/my_analytics_collection/event/search_click` to send a `search_click` event to an analytics collection called `my_analytics_collection`.\",\"value\":\"{\\n \\\"session\\\": {\\n \\\"id\\\": \\\"1797ca95-91c9-4e2e-b1bd-9c38e6f386a9\\\"\\n },\\n \\\"user\\\": {\\n \\\"id\\\": \\\"5f26f01a-bbee-4202-9298-81261067abbd\\\"\\n },\\n \\\"search\\\":{\\n \\\"query\\\": \\\"search term\\\",\\n \\\"results\\\": {\\n \\\"items\\\": [\\n {\\n \\\"document\\\": {\\n \\\"id\\\": \\\"123\\\",\\n \\\"index\\\": \\\"products\\\"\\n }\\n }\\n ],\\n \\\"total_results\\\": 10\\n },\\n \\\"sort\\\": {\\n \\\"name\\\": \\\"relevance\\\"\\n },\\n \\\"search_application\\\": \\\"website\\\"\\n },\\n \\\"document\\\":{\\n \\\"id\\\": \\\"123\\\",\\n \\\"index\\\": \\\"products\\\"\\n }\\n}\"}},\"schema\":{\"type\":\"object\"}}},\"required\":true},\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"properties\":{\"accepted\":{\"type\":\"boolean\"},\"event\":{\"type\":\"o…", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 3, + "fingerprint": "sha256:ac4eb6548c39460a5ecce3f0c8c80aa59b458713afc81c081d126915c5ca116d", + "api": "elasticsearch", + "version": "9.0.0", + "previous_version": "8.19.0", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "DELETE /_application/analytics/{name}" + }, + "description": "Operation DELETE /_application/analytics/{name} marked deprecated.", + "source_url": "https://raw.githubusercontent.com/elastic/elasticsearch-specification/57ecfe5fda6976b94fc8b8830ecb51f4969dccd6/output/openapi/elasticsearch-openapi.json", + "source_pointer": "/paths/~1_application~1analytics~1{name}/delete", + "source_excerpt": "{\"deprecated\":true,\"description\":\"The associated data stream is also deleted.\",\"operationId\":\"search-application-delete-behavioral-analytics\",\"parameters\":[{\"deprecated\":false,\"description\":\"The name of the analytics collection to be deleted\",\"in\":\"path\",\"name\":\"name\",\"required\":true,\"schema\":{\"$ref\":\"#/components/schemas/_types.Name\"},\"style\":\"simple\"}],\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/_types.AcknowledgedResponseBase\"}}},\"description\":\"\"}},\"summary\":\"Delete a behavioral analytics collection\",\"tags\":[\"analytics\"],\"x-metaTags\":[{\"content\":\"Elasticsearch\",\"name\":\"product_name\"}],\"x-state\":\"Technical preview; Added in 8.8.0\"}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 4, + "fingerprint": "sha256:58610ad6c67e990ade54c586ad0cb021c4dcbb876454bb06a916f483b819e4bc", + "api": "elasticsearch", + "version": "9.0.0", + "previous_version": "8.19.0", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "GET /_application/analytics/{name}" + }, + "description": "Operation GET /_application/analytics/{name} marked deprecated.", + "source_url": "https://raw.githubusercontent.com/elastic/elasticsearch-specification/57ecfe5fda6976b94fc8b8830ecb51f4969dccd6/output/openapi/elasticsearch-openapi.json", + "source_pointer": "/paths/~1_application~1analytics~1{name}/get", + "source_excerpt": "{\"deprecated\":true,\"operationId\":\"search-application-get-behavioral-analytics-1\",\"parameters\":[{\"$ref\":\"#/components/parameters/search_application.get_behavioral_analytics-name\"}],\"responses\":{\"200\":{\"$ref\":\"#/components/responses/search_application.get_behavioral_analytics-200\"}},\"summary\":\"Get behavioral analytics collections\",\"tags\":[\"analytics\"],\"x-metaTags\":[{\"content\":\"Elasticsearch\",\"name\":\"product_name\"}],\"x-state\":\"Technical preview; Added in 8.8.0\"}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 5, + "fingerprint": "sha256:cf1e119d61e7a9acd402b6547a3854f956ca26b905ac6f6fe288d198f2894a6f", + "api": "elasticsearch", + "version": "9.0.0", + "previous_version": "8.19.0", + "change_type": "deprecation", + "breaking": false, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "PUT /_application/analytics/{name}" + }, + "description": "Operation PUT /_application/analytics/{name} marked deprecated.", + "source_url": "https://raw.githubusercontent.com/elastic/elasticsearch-specification/57ecfe5fda6976b94fc8b8830ecb51f4969dccd6/output/openapi/elasticsearch-openapi.json", + "source_pointer": "/paths/~1_application~1analytics~1{name}/put", + "source_excerpt": "{\"deprecated\":true,\"operationId\":\"search-application-put-behavioral-analytics\",\"parameters\":[{\"deprecated\":false,\"description\":\"The name of the analytics collection to be created or updated.\",\"in\":\"path\",\"name\":\"name\",\"required\":true,\"schema\":{\"$ref\":\"#/components/schemas/_types.Name\"},\"style\":\"simple\"}],\"responses\":{\"200\":{\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/search_application.put_behavioral_analytics.AnalyticsAcknowledgeResponseBase\"}}},\"description\":\"\"}},\"summary\":\"Create a behavioral analytics collection\",\"tags\":[\"analytics\"],\"x-metaTags\":[{\"content\":\"Elasticsearch\",\"name\":\"product_name\"}],\"x-state\":\"Technical preview; Added in 8.8.0\"}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 6, + "fingerprint": "sha256:245db5b4444fca5f4b864b5088d433ece32370538217d21dacc48d5cbb245eac", + "api": "elasticsearch", + "version": "9.0.0", + "previous_version": "8.19.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "GET /{index}/_knn_search" + }, + "description": "Operation GET /{index}/_knn_search removed.", + "source_url": "https://raw.githubusercontent.com/elastic/elasticsearch-specification/fd5d063c4824de5d33618b7fca4df0e6c1b8489f/output/openapi/elasticsearch-openapi.json", + "source_pointer": "/paths/~1{index}~1_knn_search/get", + "source_excerpt": "{\"deprecated\":true,\"description\":\"NOTE: The kNN search API has been replaced by the `knn` option in the search API.\\n\\nPerform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents.\\nGiven a query vector, the API finds the k closest vectors and returns those documents as search hits.\\n\\nElasticsearch uses the HNSW algorithm to support efficient kNN search.\\nLike most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed.\\nThis means the results returned are not always the true k closest neighbors.\\n\\nThe kNN search API supports restricting the search using a filter.\\nThe search will return the top k documents that also match the filter query.\\n\\nA kNN search response has the exact same structure as a search API response.\\nHowever, certain sections have a meaning specific to kNN search:\\n\\n* The document `_score` is determined by the similarity between the query and document vector.\\n* The `hits.total` object contains the total number of nearest neighbor candidates considered, which is `num_candidates * num_shards`. The `hits.total.relation` will always be `eq`, indicating an exact value.\",\"operationId\":\"knn-search\",\"parameters\":[{\"$ref\":\"#/components/parameters/knn_search-index\"},{\"$ref\":\"#/components/parameters/knn_search-routing\"}],\"requestBody\":{\"$ref\":\"#/components/requestBodies/knn_search\"},\"responses\":{\"200\":{\"$ref\":\"#/components/responses/knn_search-200\"}},\"summary\":\"Run a knn search\",\"tags\":[\"search\"],\"x-metaTags\":[{\"content\":\"Elasticsearch\",\"name\":\"product_name\"}],\"x-state\":\"Technical preview; Added in 8.0.0\"}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 7, + "fingerprint": "sha256:e1850b21011cbdf095b88fbdbe1eaa522be2fab47912258bc06742f96bbbe44c", + "api": "elasticsearch", + "version": "9.0.0", + "previous_version": "8.19.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "POST /{index}/_knn_search" + }, + "description": "Operation POST /{index}/_knn_search removed.", + "source_url": "https://raw.githubusercontent.com/elastic/elasticsearch-specification/fd5d063c4824de5d33618b7fca4df0e6c1b8489f/output/openapi/elasticsearch-openapi.json", + "source_pointer": "/paths/~1{index}~1_knn_search/post", + "source_excerpt": "{\"deprecated\":true,\"description\":\"NOTE: The kNN search API has been replaced by the `knn` option in the search API.\\n\\nPerform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents.\\nGiven a query vector, the API finds the k closest vectors and returns those documents as search hits.\\n\\nElasticsearch uses the HNSW algorithm to support efficient kNN search.\\nLike most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed.\\nThis means the results returned are not always the true k closest neighbors.\\n\\nThe kNN search API supports restricting the search using a filter.\\nThe search will return the top k documents that also match the filter query.\\n\\nA kNN search response has the exact same structure as a search API response.\\nHowever, certain sections have a meaning specific to kNN search:\\n\\n* The document `_score` is determined by the similarity between the query and document vector.\\n* The `hits.total` object contains the total number of nearest neighbor candidates considered, which is `num_candidates * num_shards`. The `hits.total.relation` will always be `eq`, indicating an exact value.\",\"operationId\":\"knn-search-1\",\"parameters\":[{\"$ref\":\"#/components/parameters/knn_search-index\"},{\"$ref\":\"#/components/parameters/knn_search-routing\"}],\"requestBody\":{\"$ref\":\"#/components/requestBodies/knn_search\"},\"responses\":{\"200\":{\"$ref\":\"#/components/responses/knn_search-200\"}},\"summary\":\"Run a knn search\",\"tags\":[\"search\"],\"x-metaTags\":[{\"content\":\"Elasticsearch\",\"name\":\"product_name\"}],\"x-state\":\"Technical preview; Added in 8.0.0\"}", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 8, + "fingerprint": "sha256:eaae479ba14d5d2779649052f53e9c9f2987b4cd01b284e94e7a5cf177f8514c", + "api": "elasticsearch", + "version": "9.0.0", + "previous_version": "8.19.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "api_operation", + "kind": "operation", + "side": "request", + "operation": "POST /{index}/_unfreeze" + }, + "description": "Operation POST /{index}/_unfreeze removed.", + "source_url": "https://raw.githubusercontent.com/elastic/elasticsearch-specification/fd5d063c4824de5d33618b7fca4df0e6c1b8489f/output/openapi/elasticsearch-openapi.json", + "source_pointer": "/paths/~1{index}~1_unfreeze/post", + "source_excerpt": "{\"deprecated\":true,\"description\":\"When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again.\\n\\n## Required authorization\\n\\n* Index privileges: `manage`\\n\",\"operationId\":\"indices-unfreeze\",\"parameters\":[{\"deprecated\":false,\"description\":\"Identifier for the index.\",\"in\":\"path\",\"name\":\"index\",\"required\":true,\"schema\":{\"$ref\":\"#/components/schemas/_types.IndexName\"},\"style\":\"simple\"},{\"deprecated\":false,\"description\":\"If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices.\\nThis behavior applies even if the request targets other open indices.\",\"in\":\"query\",\"name\":\"allow_no_indices\",\"schema\":{\"default\":true,\"type\":\"boolean\"},\"style\":\"form\"},{\"deprecated\":false,\"description\":\"Type of index that wildcard patterns can match.\\nIf the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.\\nSupports comma-separated values, such as `open,hidden`.\\nValid values are: `all`, `open`, `closed`, `hidden`, `none`.\",\"in\":\"query\",\"name\":\"expand_wildcards\",\"schema\":{\"allOf\":[{\"$ref\":\"#/components/schemas/_types.ExpandWildcards\"}],\"default\":\"open\"},\"style\":\"form\"},{\"deprecated\":false,\"description\":\"If `false`, the request returns an error if it targets a missing or closed index.\",\"in\":\"query\",\"name\":\"ignore_unavailable\",\"schema\":{\"default\":false,\"type\":\"boolean\"},\"style\":\"form\"},{\"deprecated\":false,\"description\":\"Period to wait for a connection to the master node.\\nIf no response is received before the timeout expires, the request fails and returns an error.\",\"in\":\"query\",\"name\":\"master_timeout\",\"schema\":{\"allOf\":[{\"$ref\":\"#/components/schemas/_types.Duration\"}],\"default\":\"30s\"},\"style\":\"form\"},{\"deprecated\":false,\"description\":\"Period to wait for a response.\\nIf no response is received before the timeout expires, the request fails and returns an error.\",\"in\":\"query\",\"name\":\"timeout\",\"schema\":{…", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + } +] diff --git a/providers/README.md b/providers/README.md index 9276402..12c13e7 100644 --- a/providers/README.md +++ b/providers/README.md @@ -17,6 +17,7 @@ One page per plugin id: `providers/.md`. Start from [`_template.md`](_templ | [vercel.md](vercel.md) | `vercel` | `openapi` | | [supabase.md](supabase.md) | `supabase` | `openapi` | | [algolia.md](algolia.md) | `algolia-search`, `algolia-ingestion`, `algolia-recommend` | `openapi` | +| [elasticsearch.md](elasticsearch.md) | `elasticsearch` | `openapi` | | [openai-models.md](openai-models.md) | `openai-models` | `retirements` | | [anthropic-models.md](anthropic-models.md) | `anthropic-models` | `retirements` | | [anthropic.md](anthropic.md) | `anthropic` | `migrationguide` | diff --git a/providers/elasticsearch.md b/providers/elasticsearch.md new file mode 100644 index 0000000..c1dcdbf --- /dev/null +++ b/providers/elasticsearch.md @@ -0,0 +1,53 @@ +# Elasticsearch (`elasticsearch`) + +## What it watches + +The Elasticsearch REST API, minor version by minor version: operations Elastic marks deprecated, and removals of operations it had marked deprecated, between two versions of the OpenAPI spec generated from Elastic's API specification. + +Format plugin: `openapi` (`plugins/openapi`), with `adapter.Elasticsearch`. + +## Why this source + +- **Source:** `output/openapi/elasticsearch-openapi.json` in [elastic/elasticsearch-specification](https://github.com/elastic/elasticsearch-specification), on the branch of the newest minor version Elastic has released, pinned to that branch's head commit (`https://raw.githubusercontent.com/elastic/elasticsearch-specification//output/openapi/elasticsearch-openapi.json`). + - The newest released version comes from [elastic/elasticsearch](https://github.com/elastic/elasticsearch)'s releases. The branch list comes from the GitHub refs API. + - Checked on 2026-11-19. +- **Why this one:** the specification is what Elastic generates its official clients and its API reference from. + - It has one branch per minor version, and the OpenAPI output exists from 8.14 on. + - Deprecations use the `deprecated` flag. + - Its removals of deprecated operations match Elastic's release notes: the 9.0 spec drops `POST /{index}/_unfreeze`, and the [9.0.0 breaking changes](https://www.elastic.co/docs/release-notes/elasticsearch/breaking-changes) say "Remove unfreeze REST endpoint". +- **Alternatives considered:** + - **The [breaking changes](https://www.elastic.co/docs/release-notes/elasticsearch/breaking-changes) and [deprecations](https://www.elastic.co/docs/release-notes/elasticsearch/deprecations) pages,** served as Markdown with one section per release. They're prose grouped by area, and most bullets are about settings, analyzers, privileges or behavior ("Set allow_partial_search_results=true by default"), not an endpoint. That makes them a check on the spec rather than a source to read events from. + - **`output/schema/schema.json` in the same repo.** It's the specification's own model, of which the OpenAPI output is a rendering. + - **The clients' changelogs** (`elasticsearch-py`, `elasticsearch-js`). They're generated from the same specification. +- **Quote:** "Remove unfreeze REST endpoint" (Elastic's 9.0.0 breaking changes; `POST /{index}/_unfreeze`, deprecated in the 8.19 spec, is gone from 9.0's) + +## How the provider announces changes + +- **Versions are the product's:** minor releases (9.5), patch releases on each, and two majors maintained side by side (8.19 patches came out after 9.5's). The event's `version` is the minor's first release (`9.0.0`). That's also what a repo pins: the clients' versions follow the server's (`elasticsearch-py` 9.5.1 for Elasticsearch 9.5). +- **An API is deprecated in one version and removed in a later major,** typically. + +## What the plugin reads and ignores + +- **Reads:** the spec at the head of the newest released minor's branch, diffed against the last one read. That covers fixes landing on the branch and, once Elastic releases the next minor, the move to its branch. The next, unreleased minor (9.6 on 2026-11-19) isn't read: its spec can still change before it ships. +- **Two events come out of it:** + - **Deprecations:** an operation that gains the `deprecated` flag, quoting the whole operation. + - **Removals (breaking):** an operation that leaves the spec after the previous version had marked it deprecated. +- **Matches operations by path template.** +- **Counts a removal only from one minor to the next.** A release branch's spec gets fixes after its .0 release (the 9.2 branch dropped `GET /_project/tags` after 9.2.0), and Elasticsearch removes APIs in a new minor or major, never in a patch. So a removal between two commits of one branch is a correction to the spec, even of a deprecated operation, and isn't an event. A deprecation on a branch after its .0 is still one, dated by that minor's `.0`. +- **Ignores everything else:** + - **Removals of operations that were never deprecated.** 31 of them over 8.14 to 9.6 (compared in version order), and they mostly weren't removals from Elasticsearch: + - APIs a later minor of the older major has and the newer major's branch, cut earlier, didn't yet. 8.19 to 9.0 drops `/_data_stream/{name}/_options`, which is back in 9.1. + - APIs Elastic documents as not for direct use ("designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported."), left out of the spec from 9.2: `/_autoscaling`, `/_nodes/{node_id}/shutdown`. + - **Property changes, and new operations.** +- **History:** over 8.14 to 9.6, this keeps 26 events. + - **23 deprecations.** For example, the rollup and legacy `_template` endpoints (8.17), `/_application/analytics` (9.0), and `POST /_ml/anomaly_detectors/{job_id}/_flush` (9.1). + - **3 removals, in 9.0:** GET and POST `/{index}/_knn_search`, and POST `/{index}/_unfreeze`. +- **Replays** 8.19 → 9.0 in the golden test. The drop test replays 9.1 → 9.2. + +## Known gaps + +- **Only from 8.14,** when the specification started generating OpenAPI. +- **Deprecations announced only in the release notes aren't events.** That includes settings, parameters described in prose, and behavior changes. +- **A "removed" event means removed from the spec.** An operation dropped from the spec while Elasticsearch still serves it would read as removed if it had been marked deprecated. `vercel`, `supabase` and the `algolia-*` plugins share this. +- **The two maintained majors are read as one line.** When the newest release is a 9.x minor, an 8.19-only deprecation isn't read. +- **Request and response property changes aren't events,** including deprecated parameters.