Skip to content

Fixes #34369: send NLQ fallback and aggregate text through the search builder - #34383

Merged
manerow merged 2 commits into
mainfrom
fix/34369-search-fieldless-query-string
Oct 1, 2026
Merged

manerow merged 2 commits into
mainfrom
fix/34369-search-fieldless-query-string

Conversation

@manerow

@manerow manerow commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #34369

Problem

Two search endpoints send the user's text to OpenSearch as a query_string without a field list:

  • the NLQ endpoint's keyword fallback (/v1/search/nlq/query when the question cannot be translated), and
  • /v1/search/aggregate when q is plain text.

OpenSearch then searches all 229 fields of the table index, including .ngram subfields that cut each word into every 3 to 20 character piece. A single 21-character word needs more than 1024 clauses, OpenSearch's default limit, so the request fails with too_many_nested_clauses: a 500 on the table index, or a 200 with the table shards silently missing on the dataAsset and all aliases.

Why it happened now

Table aliases (#33415 on 2.0, #31829 on main) added one more .ngram field to the table mapping, which pushed ordinary inputs over the limit. Full analysis in #34369.

What this PR changes

  • The NLQ fallback now runs the same keyword search as /v1/search/query. It gets the configured fields and boosts from Search Settings, the existing clause budget, and the request's filters.
  • /v1/search/aggregate builds plain-text q with the same search-settings builder it already uses for queryText, on data-asset indexes, all and dataAsset. JSON queries, *, a blank q and other indexes keep today's behaviour.
  • OpenSearch and Elasticsearch change the same way.

What users will notice

  • NLQ and aggregate requests with long words or long sentences stop failing or losing results.
  • Multi-word plain text in aggregate q now needs all words to match, like /v1/search/query. The UI is unaffected: it sends search text as queryText and filters as JSON.
  • The NLQ fallback now excludes soft-deleted entities by default and honours query_filter, post_filter, sort and paging, which it used to ignore. Visibility rules passed through query_filter now apply to it too.

How it was tested

  • New unit tests for both engines capture every request sent to the cluster. They fail on the old code and pass now, and pin the unchanged cases: JSON q, *, blank q, field-qualified filters such as fullyQualifiedName:"...", and non data-asset indexes.
  • New SearchFieldlessQueryIT sends 21 and 40 character tokens to both endpoints on table_search_index and dataAsset, on OpenSearch at the default clause limit. Without this change both tests fail with the same too_many_nested_clauses error as the nightly; with it they pass. Longer tokens are covered by Bound the clause cost of every search path #34380.
  • The Collate 2.0 suite that caught this reproduces its 4 SearchRelevancyIT failures without this change; with it all 14 tests pass, and the whole Collate search package passes on 2.0 and main once the test below is gated.

Merge order

Merge after open-metadata/openmetadata-collate#7039: a Collate test assumed any NLQ answer containing its table came from a translation, which the fallback now breaks.

Not in this PR

Bounding the cost of every other search path (search-time analysis of .ngram fields, very long tokens, string filters, a clause-budget test for every index) is tracked in #34380.

@manerow
manerow requested a review from a team as a code owner October 1, 2026 13:53
@manerow
manerow requested a review from mohityadav766 October 1, 2026 13:53
@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Oct 1, 2026
@gitar-bot

gitar-bot Bot commented Oct 1, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🔴 High risk · NLQ fallback now applies visibility filters, changing users’ searchable entities.

Fixes the too_many_nested_clauses failures on NLQ fallback and aggregate search by routing both through the search builder with configured field lists, preventing unbounded .ngram subfield expansion. The NLQ fallback now also respects filters, soft-delete exclusion, and sort/paging settings. No issues found.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 796228866e75447058574a3a9cd7aa285112ae7f in Playwright run 36878844469, attempt 1.

✅ 4655 passed · ❌ 0 failed · 🟡 3 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 38m 48s

⏱️ Max setup 7m 2s · max shard execution 20m 33s · max shard-job elapsed before upload 24m 38s · reporting 15s

🌐 224.82 requests/attempt · 2.21 app boots/UI scenario · 42.50% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 42.5% (convergence target: at most 15%).
  • Browser traffic was 224.82 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.21 per UI scenario (10909 boots / 4947 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard advanced-search-01 63 0 0 0 0 0
✅ Shard advanced-search-02 67 0 0 0 0 0
✅ Shard chromium-01 129 0 0 0 0 0
✅ Shard chromium-02 148 0 0 0 0 0
✅ Shard chromium-03 164 0 0 0 0 0
✅ Shard chromium-04 157 0 0 0 0 0
✅ Shard chromium-05 115 0 0 0 0 0
✅ Shard chromium-06 137 0 0 0 0 0
✅ Shard chromium-07 168 0 0 0 0 0
✅ Shard chromium-08 158 0 0 0 0 0
✅ Shard chromium-09 155 0 0 0 0 0
✅ Shard chromium-10 162 0 0 0 0 0
✅ Shard chromium-11 131 0 0 0 0 0
✅ Shard chromium-12 160 0 0 0 0 0
✅ Shard chromium-13 165 0 0 0 0 0
✅ Shard chromium-14 151 0 0 0 0 0
✅ Shard chromium-15 138 0 0 0 0 0
✅ Shard chromium-16 162 0 0 0 0 0
🟡 Shard chromium-17 135 0 1 0 0 0
✅ Shard chromium-18 162 0 0 0 0 0
✅ Shard chromium-19 159 0 0 0 0 0
🟡 Shard chromium-20 181 0 1 0 0 0
✅ Shard chromium-21 137 0 0 0 0 0
✅ Shard chromium-22 129 0 0 0 0 0
✅ Shard chromium-23 170 0 0 0 0 0
✅ Shard chromium-24 160 0 0 0 0 0
✅ Shard chromium-25 171 0 0 0 0 0
🟡 Shard chromium-26 128 0 1 1 0 0
✅ Shard chromium-27 147 0 0 0 0 0
✅ Shard data-asset-rules-01 65 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard import-export-01 80 0 0 0 0 0
✅ Shard import-export-02 72 0 0 0 0 0
✅ Shard ingestion-01 30 0 0 0 0 0
✅ Shard ingestion-02 31 0 0 0 0 0
✅ Shard ingestion-03 32 0 0 0 0 0
✅ Shard reindex-01 41 0 0 0 0 0
✅ Shard search-01 16 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0
🟡 3 flaky test(s) (passed on retry)
  • Features/DataProductDomainMigration.spec.ts › Data product remains visible after moving domains and deleting the original domain (shard chromium-17, 1 retry)
  • Features/DataQuality/TestLibrary.spec.ts › should create, edit, and delete a test definition (shard chromium-20, 1 retry)
  • Features/ContextCenterArticlesFilters.spec.ts › filters stay applied and consistent across every sort (shard chromium-26, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bound the clause cost of search queries: field-less query_string and search-time ngram analysis exceed max_clause_count

2 participants