Repository navigation
Fixes #31878: return 400 for a search against an index OpenMetadata does not manage (backport 2.0 #35516) - #35517
Conversation
…oes not manage (backport 2.0 #35516)
Code Review ✅ Approved🟡 Medium risk · Reclassifying unknown search-index failures from 500 to 400 could alter client error handling for requests using unmanaged index names. Backports the unknown-index search fix to 2.0: a search against an index name OpenMetadata does not manage now returns 400 VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|



Issue
Cherry-pick of PR #35516 (Fixes #31878)
On 2.0.x, a search against an index name OpenMetadata does not have, such as
GET /api/v1/search/query?index=nope_search_index, returns a 500 and is logged as a server error, although the caller made the mistake. This backport brings main's fix to 2.0, so it ships in 2.0.6. It completes #31878 on 2.0, next to the other cases that PR #35440 already brought over.What this PR changes
The same change as on main: when the engine says an index is missing, a name OpenMetadata does not manage gives a 400
Unknown search index [...], and a managed index that is missing from the cluster keeps the 500Failed to find index ..., so a real outage still alerts. See PR #35516 for the full explanation.The cherry-pick had two conflicts, both caused by main-only context around the new lines: a Javadoc in
SearchRepositoryabout column indexing, and tests plus a helper inSearchResourceITthat 2.0 already has from PR #35302. Only this PR's own lines were kept. Every file now applies main's change line for line.How it was tested
On this branch:
SearchIndexUtilsTestandSearchEngineErrorsTestcases: 354 tests, all passing.SearchResourceITon Elasticsearch and on OpenSearch: an unknown index returns 400, a missing document in a real index still returns 404, and the existing malformed-input tests still pass (12 of 12 on each engine).