Skip to content

Negative from/size on search endpoints reach the search engine and fail as a server error #35037

Description

@mohityadav766

Affected module

Search / Discovery

Describe the bug

The search endpoints pass the from and size query parameters to Elasticsearch/OpenSearch without validating them. A negative value such as

GET /api/v1/search/query?q=*&index=user&from=-25&size=25

is only rejected by the engine, with [from] parameter cannot be negative, found [-25]:

  • On 2.0.x every such request fails as a 500 and logs a full server-side stack trace.
  • On main, Fixes #27990: stop malformed search input failing as a server error #33655 turned the engine's 400 into a 400 for /v1/search/query, but the request still makes a round trip to the engine. /v1/search/nlq/query and /v1/search/fieldQuery still return 500, and the /v1/search/preview request body has the same gap.

To Reproduce

  1. As an admin, call GET /api/v1/search/fieldQuery?fieldName=name&fieldValue=orders&index=table_search_index&from=-25.
  2. The response is 500 UNHANDLED_SERVER_EXCEPTION, wrapping the engine's illegal_argument_exception.
  3. On 2.0.x, GET /api/v1/search/query?q=*&index=user&from=-25&size=25 fails the same way.

Expected behavior

A negative from or size is rejected with a 400 that names the parameter, before any search runs.

OpenMetadata version

2.0.4 and 2.0.5, and main (f0d254f)

Additional context

-25 is page 0 at a page size of 25. The UI's search helpers compute from = (page - 1) * size, so any caller that passes page 0 produces it.

Pre-submission checklist

  • I searched for duplicate issues.
  • I removed credentials, hostnames, emails, and other sensitive data from logs and config.

Activity

  1. added
    bug
    on Oct 9, 2026
  2. self-assigned this
    on Oct 9, 2026
  3. added this to Shipping and removed this from Roadmapon Oct 9, 2026
  4. pinned this issue on Oct 9, 2026
  5. closed this as completedby moving to Done ✅ in Shippingon Oct 9, 2026
  6. moved this from Done ✅ to In Review / QA 👀 in Shippingon Oct 9, 2026
  7. moved this from Done ✅ to In Review / QA 👀 in Shippingon Oct 9, 2026
  8. added theissue type on Oct 9, 2026
  9. moved this from In Review / QA 👀 to Done ✅ in Shippingon Oct 9, 2026
  10. added a commit that references this issue on Oct 9, 2026
    893cd1b
  11. added a commit that references this issue on Oct 13, 2026
    492b90f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

  • Status
    Done ✅

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions