Repository navigation
Rank an API operation by its route when the request line has another method - #4910
Merged
Merged
Conversation
…ethod `GET /_search` lists "Get the search shards" first and "Run a search" fourth, while `POST /_search` and `/_search` list "Run a search" first. The case fails on the dev index until the next commit. The controls `POST /_search`, `/_search`, `/_search knn`, `GET /_cluster/health` and `GET /_search_shards` pass today and pin the other side. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…method `GET /_search` listed "Get the search shards" first because the whole-title lift read the raw query, so `get` and `search*` had to be title words. "Run a search" lost that 3.0 and fell to fourth. A method typed before a path now names only the verb: the title lifts read the query without it, and the method still lifts operations that use it by 0.5. Measured on the dev index, `GET /_search` lists "Run a search" first at 10.20, then the scrolling search at 9.70. Queries without a method before a path build the same text as before. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4910/ Sample changed pages: |
akira28
approved these changes
Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
API search now ranks
POST /{index}/_searchfirst forGET /_search, where it used to list "Get the search shards" first and "Run a search" fourth.Affects: Search, API reference
Prompt summary: Fix API search for a pasted request line whose method differs from the operation's canonical one, found while verifying newsletter examples. The route must decide the ranking, and a mismatched method may cost a little but never drop the operation below operations that only share a word with its path.
Why
The whole-title lift reads the raw query, so
GET /_searchasks for a title that holdsgetandsearch*. Every "Get … search …" title earns that lift (3.0) and "Run a search" does not. The method is not required or demoted: it only adds a 0.5 lift, so the mismatch was never the cause.What
The method names the verb, not a title word
Tokenizealready folds a method typed before a path into the path word. The title lifts (title_all,title_named, starts-with and the landing-page guards) now read the same query without that method, throughTitleText. A method that does not sit before a path, as inget cluster settings, stays a title word, and every query without a method before a path builds the same text as before. The method still lifts operations that use it byApiLookupWeights.Method.Judged cases
GET /_searchis a new judged case, in its own commit ahead of the fix. The controlsPOST /_search,/_search,/_search knn,GET /_cluster/healthandGET /_search_shardspass before and after. A unit test pins the title text the lifts receive.The docs-wide search is unchanged: only
ApiLookupQueryBuilderchanged, andSearchQueryBuilderdid not.Verify
Measured through the real gateway on the dev index, top three of
ApiSearchRelevanceReportbefore and after:GET /_searchsearch10.20 (stack and Serverless), scroll 9.70POST /_search,/_searchsearchfirstGET /_cluster/healthAcross the 82 reported queries the top three changed only for
GET /_search. Scores moved without reordering forPOST /_count(7.20 to 10.20, the title now matchescount) andHEAD /(12.86 to 9.86, the lone/is no title word; its margin overinfois still 2.66).Regression checks, all on the dev index:
DELETE,PUT,PATCH, Kibana routes) diffed before and after. Most only gained or lost a flat 3.0 with the same order.GET /_searandGET /{index}/_searchnow lead withsearch. Four third places changed to operations that name the typed route:GET /_security/user,GET /_mapping,GET /_ml/anomaly_detectorsandPOST /_reindex. Before, a title that starts withGetheld that place.GET /_search,POST /_search,/_searchandGET /_cluster/healthon a Debug build return the same order as the gateway report.The integration cases are not run in CI.
ApiSearchPlainWordDoesNotCoverTheRoutesUnderItsOwnNamealso fails onmain.Out of scope:
GET /_searchranks thePOSToperation 0.5 belowPOST /_search, which is the intended cost of the mismatch.🤖 Generated with Claude Code