Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
915b31a
Carry API operation deprecation onto the sidebar nav node
reakaleek Nov 3, 2026
0f34009
Strike through deprecated operations in the legacy API sidebar
reakaleek Nov 3, 2026
e5e5e71
Strike through deprecated operations in the design-system sidebar
reakaleek Nov 3, 2026
4ee6b0c
Return the deprecated flag of API operations from navigation search
reakaleek Nov 3, 2026
4f71220
Show a Deprecated badge on deprecated API operations in search
reakaleek Nov 3, 2026
da4b5d6
Document how deprecated API operations look in search and the sidebar
reakaleek Nov 3, 2026
c3b150f
Render the search Deprecated badge with the operation page's title ba…
reakaleek Nov 3, 2026
70587f3
Keep the sidebar example helper at four parameters and name the boole…
reakaleek Nov 3, 2026
467f28c
Strike through deprecated operations in search and shrink the badge t…
reakaleek Nov 3, 2026
9667e97
Centre the search Deprecated badge on the title line
reakaleek Nov 3, 2026
ea85fca
Merge remote-tracking branch 'origin/main' into deprecate-ops-nav-sea…
reakaleek Nov 6, 2026
2625149
Accept the sidebar snapshots that now include the deprecated example row
reakaleek Nov 6, 2026
8490402
Keep the method chip's colour on deprecated rows and lower its satura…
reakaleek Nov 6, 2026
dccfc38
Mark deprecated operations in the header search and the design-system…
reakaleek Nov 6, 2026
fee18cc
Hide the dialog's Deprecated badge until a row reveals it
reakaleek Nov 6, 2026
d10f576
Fetch the exporter test's specs from the version index host
reakaleek Nov 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/data/openapi/api-explorer.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The API title comes from `info.title` in the spec, so fix naming and description

API search matches parameter and field names, including prefixes and qualified paths. A qualified path matches by its segments from any depth and ignores `[]` and `<string>`. So `rrf.min_score` finds `retriever.rrf.min_score`, and `retriever[].standard` reads as `retriever.standard`. The docs-wide search matches a field only by its exact name, and only for a word that contains `_` or `.`, so a plain word keeps ranking pages first. Direct operation and endpoint matches rank above field matches. Each word of the query names something about an operation. It can be the endpoint path or its `_name`, which also covers the routes under it, a word of the operation id or path, the operation's group, a word of its title, a parameter or field name, or a word in its description. Operation id and path words split on dots, hyphens, underscores and case changes. The best match for each word counts, and word order does not matter. With one or two words, every word must match. From three words on, most of them must. An endpoint path or `_name` always outranks a name word, and a name word outranks a group word or a field. So `ml flush`, `flush ML job` and `_ml _flush` all find `POST /_ml/anomaly_detectors/{job_id}/_flush`. Combine an endpoint and a field, such as `_search knn`, to find the operation and its matching fields. `knn /_search`, `/_search knn`, `knn search` and `search knn` read the same. A word with a leading slash only ever names an endpoint. It also covers the routes under it, so `/api/fleet` lists every Fleet operation and `/_cluster health` finds the cluster health operation. A last segment that is not complete reads as the start of one, so `/_sear` finds `/_search` and then the routes under it, and `/_cat/ind` finds `/_cat/indices`. A trailing slash says the segment is complete, so `/_search/` lists `/_search` and the routes under it, and nothing that merely starts with `_search`. A lone `/` names the root route, so `/`, `GET /` and `HEAD /` find the operations on `/` and nothing under it. The underscore that starts an Elasticsearch system route is optional, so `/search` and `/cluster health` read as `/_search` and `/_cluster/health`. An HTTP method typed before it belongs to that endpoint. A field word needs no endpoint beside it, so `cluster flat_settings` lists the Cluster operations that take `flat_settings`, `GET /_cluster/state` and `GET /_cluster/settings` among them, each with its `flat_settings` query parameter, and `es|ql drop_null_columns` finds `POST /_query` with its `drop_null_columns` parameter. A field row lists under the operation only when its word matched a field at least as well as anything else about the operation, so `search retriever` lists `retriever` but no `search_type` row. Each matching operation lists up to three matching fields beneath it, with their paths, types, and locations. Child rows match the field's own name; ancestor names and descriptions provide context without adding unrelated children. Select a field to open its anchor, including fields inside collapsed sections. Arrow keys move through operations and fields in order; Enter opens the selected row. Type a field's path with a trailing dot, such as `retriever.`, and the operation also lists the fields nested under it as rows of their own, `retriever.standard`, `retriever.knn`, and the rest in page order, right after the field they belong to; without the dot the result is the matching fields alone. Each row shows where the field lives: `path`, `query`, `header`, `request body`, or `response body`. The child rows mirror the operation page: a field whose type has its own page, such as `query`, lists none, and a field that repeats an earlier listing lists none either.

An operation result shows one route in place of the description: the method the page leads with and the path, with a match highlighted when a query word names a path. The route whose whole path is the query word wins, so `/_search` shows `/_search`; otherwise the operation's primary route shows when it contains the word, an alternate route only when the primary does not, and the primary route when no word names a route. Every result uses the same bordered box, with matching fields grouped beneath the operation when present. Matches use the same yellow tint as the destination property's flash. Navigating to a field reveals it and flashes its name, including when search replaces the current page without a full reload. Each result's breadcrumb ends with the operation's group, the same group the page shows.
An operation result shows one route in place of the description: the method the page leads with and the path, with a match highlighted when a query word names a path. The route whose whole path is the query word wins, so `/_search` shows `/_search`; otherwise the operation's primary route shows when it contains the word, an alternate route only when the primary does not, and the primary route when no word names a route. Every result uses the same bordered box, with matching fields grouped beneath the operation when present. Matches use the same yellow tint as the destination property's flash. Navigating to a field reveals it and flashes its name, including when search replaces the current page without a full reload. Each result's breadcrumb ends with the operation's group, the same group the page shows. A deprecated operation is struck through and dimmed in the results, its method chip keeps its colour at lower saturation as in the sidebar, and the same outlined `Deprecated` badge as on its page sits beside the title at the method chip's height. The header search and the design-system search dialog mark a deprecated operation the same way.

The assembler indexes fields from the same property trees used to render operation pages. Fields of a repeated shape appear under its first listing. On the existing semantic index, the indexer adds the nested `api.properties` mapping before incremental synchronization. Property changes participate in the document hash, so a field update is synchronized even when the operation description stays the same.

Expand Down Expand Up @@ -499,6 +499,8 @@ Every endpoint with authentication has an `Auth` badge in the row under its path

A spec that declares no `security` shows no badge.

The sidebar marks an operation that the spec sets `deprecated: true` on, in both the legacy and the design-system look. Its title is struck through and dimmed, and its method chip keeps its colour at lower saturation. Screen readers hear the word "Deprecated" after the title. The row keeps its width, so long titles wrap as before.

Each listed scheme is resolved against `components.securitySchemes`, in the order the spec lists them:

| OpenAPI scheme | Label |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public IEnumerable<DocumentationDocument> ConvertToDocuments(IndexedTree tree)
Method = method,
Path = path.Key,
OperationId = operationId,
Deprecated = operation.Value.Deprecated,
Deprecated = apiOperation.Deprecated,
Words = ApiSearchWords.Of(operationId, path.Key),
Group = groupParent?.Title ?? "",
IdWords = ApiSearchWords.OfOperationId(operationId).Length
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.ApiExplorer/Landing/ApiOverviewRow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ bool designSystem
showTooltip: false,
designSystem: designSystem
),
Deprecated = operation.Model.Operation.Deprecated,
Deprecated = operation.Model.Deprecated,
DesignSystem = designSystem
};
}
6 changes: 3 additions & 3 deletions src/Elastic.ApiExplorer/Operations/OperationCommonMark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static string Write(ApiOperation apiOperation, OperationPageModel page, A
var operation = apiOperation.Operation;
var title = OpenApiExtensionReader.GetSummary(operation) ?? apiOperation.DisplayName;
ApiCommonMark.Heading(markdown, 1, title);
WriteBadges(markdown, operation, page);
WriteBadges(markdown, apiOperation.Deprecated, page);
WriteServers(markdown, page);
WritePaths(markdown, page);
WritePathParameters(markdown, page, apiBaseUrl);
Expand All @@ -40,9 +40,9 @@ public static string Write(ApiOperation apiOperation, OperationPageModel page, A
return markdown.ToString();
}

private static void WriteBadges(StringBuilder markdown, OpenApiOperation operation, OperationPageModel page)
private static void WriteBadges(StringBuilder markdown, bool deprecated, OperationPageModel page)
{
if (operation.Deprecated)
if (deprecated)
ApiCommonMark.Paragraph(markdown, "deprecated");
if (page.AuthBadge is { } auth)
ApiCommonMark.Paragraph(markdown, $"Authentication: {auth.Summary}");
Expand Down
10 changes: 8 additions & 2 deletions src/Elastic.ApiExplorer/Operations/OperationNavigationItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ public record ApiOperation(
string Route,
IOpenApiPathItem Path,
string ApiName
) : IApiModel<OperationPageModel>, IHttpMethodNavigationModel
) : IApiModel<OperationPageModel>, IApiOperationNavigationModel
{
// The page header leads with the dominant method, which can come from the description's method listing
// rather than the spec; the sidebar badge must agree with it.
string IHttpMethodNavigationModel.HttpMethod => OperationEndpoint.Build(this, Operation.Description, []).Rows[0].Method;
string IApiOperationNavigationModel.HttpMethod => OperationEndpoint.Build(this, Operation.Description, []).Rows[0].Method;

/// <summary>
/// The one deprecation fact the page title badge, the overview rows, the sidebar row and the search index all read.
/// Collapsed siblings always agree on it, because operations that differ in lifecycle are never collapsed onto one page.
/// </summary>
public bool Deprecated => Operation.Deprecated;

/// <summary>The title shown for the operation; an operationId used as the grouping key is shown as readable words.</summary>
public string DisplayName =>
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.ApiExplorer/Operations/OperationView.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</li>
}
</ul>
@await RenderPartialAsync(_TitleBadges.Create(new TitleBadgesModel(pageModel.Availability, operation.Deprecated, Model.BuildContext.Configuration.Features.NavigationPreviewEnabled, pageModel.AuthBadge?.Text, Model.AuthBadgeHref)))
@await RenderPartialAsync(_TitleBadges.Create(new TitleBadgesModel(pageModel.Availability, Model.Operation.Deprecated, Model.BuildContext.Configuration.Features.NavigationPreviewEnabled, pageModel.AuthBadge?.Text, Model.AuthBadgeHref)))
</header>
<section id="elastic-api-v3">
@if (!string.IsNullOrWhiteSpace(pageModel.DescriptionMarkdown) || pageModel.ExternalDocs is not null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
namespace Elastic.Documentation.Navigation;

/// <summary>
/// Navigation model for an API operation leaf that exposes its HTTP method for sidebar chrome.
/// Navigation model for an API operation leaf that exposes its HTTP method and deprecation for sidebar chrome.
/// </summary>
public interface IHttpMethodNavigationModel : INavigationModel
public interface IApiOperationNavigationModel : INavigationModel
{
/// <summary>Lowercase HTTP method name (e.g. <c>get</c>, <c>post</c>).</summary>
string HttpMethod { get; }

/// <summary>True when the spec marks the operation deprecated.</summary>
bool Deprecated { get; }
}
10 changes: 10 additions & 0 deletions src/Elastic.Documentation.Site/Assets/api-docs.css
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,16 @@
border-color: var(--color-grey-100);
}

#pages-nav a.nav-link--deprecated > span:first-child {
text-decoration: line-through;
opacity: 0.7;
}

/* The chip keeps its method colour so a retired DELETE still reads as a delete; lower saturation says it is retired. */
#pages-nav a.nav-link--deprecated .nav-v2-api-method {
filter: saturate(0.4);
}

.api-url {
margin-left: calc(var(--spacing) * 2);
min-width: 0;
Expand Down
13 changes: 12 additions & 1 deletion src/Elastic.Documentation.Site/Assets/ds/search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const markup = `
<p data-search-status role="status">Type to search.</p>
<ol data-search-results role="listbox"></ol>
<template data-search-result>
<li role="option"><a href="#"><span data-search-path></span><span data-search-title></span><span data-search-excerpt></span></a></li>
<li role="option"><a href="#"><span data-search-path></span><span data-search-title></span><span data-search-deprecated hidden>Deprecated</span><span data-search-excerpt></span></a></li>
</template>
</dialog>`

Expand All @@ -44,6 +44,7 @@ const results = {
title: 'Beta',
description: 'plain text',
parents: [],
deprecated: true,
},
],
}
Expand Down Expand Up @@ -158,6 +159,16 @@ describe('search dialog', () => {
expect(items[0].querySelector('a')!.getAttribute('href')).toBe(
'/docs/a'
)
expect(items[0].hasAttribute('data-deprecated')).toBe(false)
expect(
items[0].querySelector<HTMLElement>('[data-search-deprecated]')!
.hidden
).toBe(true)
expect(items[1].hasAttribute('data-deprecated')).toBe(true)
expect(
items[1].querySelector<HTMLElement>('[data-search-deprecated]')!
.hidden
).toBe(false)
expect(
document.querySelector('[data-search-status]')!.textContent
).toBe('2 results.')
Expand Down
7 changes: 7 additions & 0 deletions src/Elastic.Documentation.Site/Assets/ds/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface SearchResult {
title: string
description: string
parents: Array<{ url: string; title: string }>
deprecated?: boolean
}

const debounceMs = 300
Expand Down Expand Up @@ -96,6 +97,12 @@ export function drawResults(
item.querySelector<HTMLElement>(
'[data-search-title]'
)!.textContent = result.title
if (result.deprecated) {
item.setAttribute('data-deprecated', '')
item.querySelector<HTMLElement>(
'[data-search-deprecated]'
)?.removeAttribute('hidden')
}
appendExcerpt(
item.querySelector<HTMLElement>('[data-search-excerpt]')!,
result.description ?? ''
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { renderWithProviders } from '../../test-utils/render'
import { ModalSearchResultsList } from './ModalSearchResultsList'
import { modalSearchStore } from './modalSearch.store'

vi.mock('./useModalSearchQuery', () => {
const operation = {
type: 'api',
url: '/docs/api/doc/elasticsearch/operation/operation-rollup-put-job',
title: 'Create a rollup job',
description: 'Creates a rollup job',
score: 1,
parents: [{ url: '/docs/api', title: 'API' }],
}
return {
useModalSearchQuery: () => ({
isLoading: false,
isFetching: false,
data: {
results: [
{ ...operation, deprecated: true },
{
...operation,
url: '/docs/api/doc/elasticsearch/operation/operation-search',
title: 'Search',
},
],
},
error: null,
}),
}
})

vi.mock('./useModalSearchTelemetry', () => ({
useModalSearchTelemetry: () => ({ trackResultClicked: vi.fn() }),
}))

describe('ModalSearchResultsList', () => {
beforeEach(() => {
modalSearchStore.getState().actions.setSearchTerm('rollup')
})

it('marks a deprecated operation with the page badge and leaves a live one plain', () => {
const { container } = renderWithProviders(
<ModalSearchResultsList
isKeyboardNavigating={{ current: false }}
onMouseMove={vi.fn()}
onResultClick={vi.fn()}
/>
)

const rows = container.querySelectorAll('a[data-search-result-index]')
expect(rows).toHaveLength(2)
expect(
rows[0].querySelector('.title-text .api-badge--danger')
).toHaveTextContent('Deprecated')
expect(rows[1].querySelector('.api-badge--danger')).toBeNull()
})
})
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { config } from '../../config'
import {
DeprecatedBadge,
deprecatedTitleText,
} from '../NavigationSearch/DeprecatedBadge'
import { SanitizedHtmlContent } from '../NavigationSearch/SanitizedHtmlContent'
import { useHtmxLink } from '../shared/htmx/useHtmxLink'
import {
Expand Down Expand Up @@ -262,7 +266,7 @@ const ModalSearchResultRow = ({
`}
>
<Breadcrumb items={breadcrumbItems} />
<Title text={result.title} />
<Title text={result.title} deprecated={result.deprecated} />
{result.description && (
<Description text={result.description} />
)}
Expand Down Expand Up @@ -337,7 +341,13 @@ const Breadcrumb = ({ items }: { items: string[] }) => {
)
}

const Title = ({ text }: { text: string }) => {
const Title = ({
text,
deprecated,
}: {
text: string
deprecated?: boolean
}) => {
const { euiTheme } = useEuiTheme()

return (
Expand All @@ -355,9 +365,12 @@ const Title = ({ text }: { text: string }) => {
font-weight: ${euiTheme.font.weight.bold};
color: ${euiTheme.colors.textParagraph};
}

${deprecated ? deprecatedTitleText : ''}
`}
>
<SanitizedHtmlContent htmlContent={text} />
{deprecated && <DeprecatedBadge />}
</div>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const SearchResultItem = z.object({
description: z.string(),
score: z.number(),
parents: z.array(SearchResultItemParent),
deprecated: z.boolean().optional(),
})

export type SearchResultItem = z.infer<typeof SearchResultItem>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { useEuiTheme } from '@elastic/eui'
import { css } from '@emotion/react'

/** Struck through and dimmed, the same treatment as a deprecated sidebar row; applied to the title's text span. */
export const deprecatedTitleText =
'& > span:first-child { text-decoration: line-through; opacity: 0.7; }'

/** The operation page's Deprecated badge, sized to sit on a result title line. */
export const DeprecatedBadge = () => {
const { euiTheme } = useEuiTheme()

return (
<span
className="api-title-badges"
css={css`
/* An atomic inline, so the row's hover underline stops at the title text. Middle alignment lands 1px low beside the bold title. */
display: inline-flex;
align-items: center;
position: relative;
top: -1px;
margin-left: ${euiTheme.size.s};
vertical-align: middle;
line-height: 1;
font-weight: ${euiTheme.font.weight.regular};
.applies {
display: inline-flex;
margin-right: 0;
}
.applicable-info {
display: inline-flex;
align-items: center;
height: calc(${euiTheme.size.base} + ${euiTheme.size.xxs});
padding: 0 ${euiTheme.size.s};
line-height: 1;
}
.applicable-name {
font-size: 10px;
line-height: 1;
}
`}
>
<span className="applies applies-inline">
<span className="applicable-info api-badge--danger">
<span className="applicable-name">Deprecated</span>
</span>
</span>
</span>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,28 @@ describe('property rows', () => {
})
})

describe('deprecated operations', () => {
beforeEach(() => {
navigationSearchStore.getState().actions.setSearchTerm('search')
})

it('shows a Deprecated badge beside the title of a deprecated operation', () => {
const { container } = renderList({
groups: groupSearchResults([{ ...operation, deprecated: true }]),
})
const badges = container.querySelectorAll(
'.title-text .api-title-badges .applicable-info.api-badge--danger'
)
expect(badges).toHaveLength(1)
expect(badges[0]).toHaveTextContent('Deprecated')
})

it('shows no badge for an operation that is not deprecated', () => {
const { container } = renderList()
expect(container.querySelector('.api-badge--danger')).toBeNull()
})
})

describe('row tooltips', () => {
const fakeTippy = (row: Element) => {
const destroy = vi.fn()
Expand Down
Loading
Loading