Repository navigation
Find an API operation when a word of its id has one typo - #4911
Merged
Merged
Conversation
`clustr health` lists "Get the cluster health" first and "Get the cluster health status" third. `clustr` explains only as a field name, so all three health operations tie at 3.63 on the dev index. The case fails until the next commit. `health cluster` joins the judged cases as a control. `clustr helth`, `creat index`, `serch knn` and `snapshot restor` join the report queries, so a run before and after the fix both list them. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
`clustr health` tied the three health operations at 3.63, because `clustr` explained only as a field name and `health` explained every operation equally. The title words cannot separate them, since all three titles carry both words. Each plain word now also matches an operation id word within one edit, using the `AUTO:4,100` fuzziness and one-letter prefix the field names already use. The new `OperationWordTypo` weight of 1.5 sits between an exact id word (2.0) and the one-point roles, so an exact match on one operation still beats a typo on another. Both options share the `id` role name. Measured on the dev index, `clustr health` leads with `cluster-health` at 4.63 against 3.63. The judged cases that passed before still pass, and no judged query changes its first result. Docs-wide search is untouched. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Fifteen of the words people type most, such as `reindex`, `put mapping` and `snapshot create`, now lead with the operation they name. They pass without this fix and guard it against moving them. Seven typo cases lead with the right operation: `cluser health`, `clustr state`, `snaphot restore`, `snapshto restore`, `reindx`, `bulck` and `indx refresh`. All but `indx refresh` fail on the commit before the fix. Six typo queries that still miss, such as `serch` and `refesh index`, join the report so a later change shows them. 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/4911/ |
`delte index` listed Kibana operations whose ids carry both words, and `creat index` and `refesh index` listed the wrong operation first. The title fingerprint is one token, so a fuzzy match on it measures the edit distance across the whole title. A typed text within one edit of a whole title now earns `TitleNamedTypo`, 2.0. The exact title is excluded, so an exact title keeps its score, and the weight sits below every endpoint key, so the lift only breaks ties. The index needs no change. Measured on the dev index, `delte index` lists "Delete indices" first at 5.63 against 4.58, `creat index` at 6.13 against 5.08 and `refesh index` at 5.63 against 3.70. A word one edit from another title lifts that title too: `get cluster stats` lists `cluster-state` 2.0 above `cluster-stats`, where the two tied before. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The field names, the operation id words and the title each built the same fuzzy match by hand, so the one-edit rule lived in three places. `SearchQueryBuilder.FuzzyWordMatch` now owns the fuzziness and the fixed first letter, and `WordFuzziness` is private again. The title lift is one `dis_max` of the exact and the typo match. That drops the `must_not` and the second run of the exact title on every request. A word shorter than four letters allows no edit, so it skips the typo option. The weights comment loses its measured scores, and one test holds the order of the exact and typo weights. The report over 127 queries and the 152 relevance cases are unchanged on the dev index. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…r word `stats` stems to `stat`, and the operation word role is a prefix match, so `stat` also began `state`. `cluster stats` tied `cluster-stats` with `cluster-state` at 11.63 and `clustr stats` listed them in either order. The role now has an exact option at 2.0, a prefix option at 1.8 and the typo option at 1.5, all under one role name. Exact words keep their scores. A word that only begins another word loses 0.2, which changed four report scores and no first result. `cluster stats` and `clustr stats` join the judged cases. `get cluster stats` still lists `cluster-state` first, because the title typo lift adds 2.0 to it, more than the 0.2 between a whole word and a prefix. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
It was one of the reported queries and only sat in the report list. The operation `snapshot restore` already leads for it, so the case passes and guards the typo match. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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 lists the same operation first when one word of four letters or more has a typo.
clustr healthleads with "Get the cluster health status", ascluster healthdoes.Affects: Search, API reference
Prompt summary: Fix API search for a typo in a word of an operation's title. Add a failing judged case first, fix the ranking in a second commit, and diff the relevance report before and after to show nothing else regresses.
Why
clustr healthlists "Get the cluster health" first and "Get the cluster health status" third. The wordclustrmatches no endpoint, id word, group or title word, so only the fuzzy field-name role explains it. That role scores the same on all three health operations, so they tie at 3.63 and the order is arbitrary. The title lift from #4908 cannot separate them, because all three titles carry both words.What
A typo of an operation id word
Each plain word now also matches an operation id word within one edit. It uses the
AUTO:4,100fuzziness and one-letter prefix that field names already use (#4750), and it reads the existingapi.wordsfield. No mapping change and no reindex are needed.A word typed whole beats one that starts another word
statsstems tostat, and the operation word role is a prefix match, sostatalso beganstateand scored like a whole word.cluster statstiedcluster-statswithcluster-stateat 11.63. The role now scores a whole word 2.0, a word that only begins another 1.8, and a typo 1.5, all under theidrole name. Exact words keep their scores.A weight between exact and approximate
OperationWordTypois 1.5, between an exact id word (2.0) and the one-point roles. An exact word on one operation still beats a typo of it on another, and a typo of an id word still beats a word that only a title, group or field name carries. Both options share theidrole name, so the result processor reads a typo as an operation word. A comment inApiLookupWeightsrecords the invariant.A title within one edit
The title fingerprint is one token, so a fuzzy match on it measures the edit distance across the whole title. A typed text within one edit of a whole title earns
TitleNamedTypo(2.0). The exact title is excluded from the lift, so an exact title keeps its score, and 2.0 sits below every endpoint key, so the lift only breaks ties. It fixescreat index,delte indexandrefesh index, whose title words a typo made unreachable. No mapping change is needed.Judged cases
The first commit adds
clustr healthas a failing case,health clusteras a control, and four typo queries to the report. The third commit adds 15 of the most typed words, such asreindex,put mappingandsnapshot create, and seven typo cases. Six of the typo cases fail on the commit before the fix:cluser health,clustr state,snaphot restore,snapshto restore,reindxandbulck. The popular words pass on both sides and guard the fix.cluster health,search knn,snapshot restoreandget cluster settingswere already judged.Verify
Measured on the dev index. The "before" column is the commit that adds the failing case, and the "after" column is a local Debug build served through
/v1/navigation-search.clustr healthcluster healthhealth clustersnapshot restorThe report covers 98 queries and six changed their top three. No judged query changed its first result, and every exact query keeps its first score (
cluster statestays at 11.63).clustr health,clustr helthandserch knnnow lead with the right operation.serch knnused to tiemsearchwithsearch.cluster statelistscluster-statssecond, ahead ofcluster-reroute, becausestateis one edit fromstats.release isolated endpointlistsendpointisolateactionthird, becauseisolatedis one edit fromisolate.close indexlistsindices-clonethird, becausecloseis one edit fromclone.The first result of those three is unchanged. The new neighbours are the cost of a typo match, and each one is a plausible sibling.
The whole relevance suite on the dev index has 126 cases. It fails 19 on the first commit and 18 with the fix, and
clustr healthis the only difference.mise run testfails only the 9 Deploying snapshot tests that depend on the comma locale of the machine.The integration cases are not run in CI.
ApiSearchPlainWordDoesNotCoverTheRoutesUnderItsOwnNamealso fails onmain.The API cases pass 109 of 110 with the fix. The three title typo cases (
creat index,delte index,refesh index) fail on the commit before the title lift. The remaining failure is the one that also fails onmain.Out of scope: Four typo queries still miss and sit in the report list:
serchtiesscrollwithsearchbecause route keys are not fuzzed,clustr settingsleads withindices-get-settingsthrough the exactsettingskey,clustr statstiescluster-statewithcluster-stats, andpiplinehas no clear expected operation. The request cost of the extra clauses per query is unmeasured.Risk: A word one edit from another title lifts that title too.
get cluster statsstill listscluster-statefirst, because the lift adds 2.0 and a whole word beats a prefix by only 0.2. A weight does not fix it:delte indexandcreat indexneed the lift at about 1.0, andstatsagainststatelooks the same to the query ascreatagainstcreate. The first result of no judged query changes.🤖 Generated with Claude Code