Skip to content

fix(search): embed ElasticSearch semantic search queries as queries, not documents - #32553

Merged
Vishnuujain merged 2 commits into
mainfrom
fix/elasticsearch-embed-query-as-query
Sep 7, 2026
Merged

Vishnuujain merged 2 commits into
mainfrom
fix/elasticsearch-embed-query-as-query

Conversation

@Vishnuujain

Copy link
Copy Markdown
Contributor

Closes #32490

ElasticSearchVectorService.search embeds the user's query with embed(query). The OpenSearch path uses embedQuery(query).

That matters for providers that treat the two differently. Cohere on Bedrock picks search_document or search_query based on which method is called, so on Elasticsearch we embed questions as if they were documents.

Effect

Semantic search ranks worse on Elasticsearch than on OpenSearch with the same data, and nothing in the logs says why.

Fix

Call embedQuery. One line.

Tests

21 pass. The new test was checked by reverting the fix first, and it fails without it.

The existing suite missed this because it stubs embed and only asserts on the mocked HTTP response, so the query vector was never looked at.

@Vishnuujain
Vishnuujain requested a review from a team as a code owner September 3, 2026 09:34
@github-actions github-actions Bot added the safe to test Add this label to run secure Github workflows on PRs label Sep 3, 2026
@Vishnuujain Vishnuujain self-assigned this Sep 3, 2026
@fmcardoso
fmcardoso self-requested a review September 3, 2026 09:59
@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 65e92e4e4b433abfe51d5f7713617cb68c8a9682 in Playwright run 34089803712, attempt 1.

✅ 944 passed · ❌ 0 failed · 🟡 2 flaky · ⏭️ 0 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) 50m 31s

⏱️ Max setup 4m 23s · max shard execution 18m 15s · max shard-job elapsed before upload 21m 18s · reporting 5s

🌐 216.08 requests/attempt · 2.39 app boots/UI scenario · 34.89% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 34.89% (convergence target: at most 15%).
  • Browser traffic was 216.08 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.39 per UI scenario (2312 boots / 969 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 154 0 0 0 0 0
✅ Shard chromium-02 142 0 0 0 0 0
🟡 Shard chromium-03 167 0 1 0 0 0
✅ Shard chromium-04 139 0 0 0 0 0
🟡 Shard chromium-05 149 0 1 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 7 0 0 0 0 0
✅ Shard ingestion-01 2 0 0 0 0 0
✅ Shard reindex-01 28 0 0 0 0 0
✅ Shard search-01 12 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0
🟡 2 flaky test(s) (passed on retry)
  • Flow/MetricListSearch.spec.ts › typing in the search box filters the metric list server-side (shard chromium-03, 1 retry)
  • Pages/Glossary.spec.ts › Verify Expand All For Nested Glossary Terms (shard chromium-05, 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

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-09-04T02:38:16Z)

Blocked the queue: playwright-summary

@Vishnuujain
Vishnuujain added this pull request to the merge queue Sep 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 4, 2026
@gitar-bot

gitar-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Fixes ElasticSearch semantic search to embed queries using embedQuery() instead of embed(), aligning with OpenSearch behavior and ensuring providers like Cohere on Bedrock apply the correct search intent. No issues found.

Options

Display: compact → Showing less information.

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

@Vishnuujain
Vishnuujain added this pull request to the merge queue Sep 7, 2026
Merged via the queue into main with commit ce2a1c1 Sep 7, 2026
120 checks passed
@Vishnuujain
Vishnuujain deleted the fix/elasticsearch-embed-query-as-query branch September 7, 2026 09:24
Vishnuujain added a commit that referenced this pull request Sep 8, 2026
…32342) (#32987)

* Fix MCP entity patch lifecycle handling (#32226)

* fix(mcp): respect entity patch lifecycles

* fix(mcp): protect task patch lifecycle

* gitarbot feedback: block document, metric, metricGroup patch lifecycles too

* reflow lifecycle comment so no entry wraps at the 100-col limit

* drop metric and metricGroup entries, reverted upstream by #32333

(cherry picked from commit ac4a26b)

* feat(search): report embedding token usage instead of discarding it (#32552)

* feat(search): report embedding token usage instead of discarding it

* fix(search): report the text the provider received, not the caller's input

(cherry picked from commit 2209bd7)

* Fixes 30023: apply the caller's policies to bot searches (#32460)

* fix(search): apply the caller's policies to bot searches (#30023)

* test: poll for the widened bot's own view in the allow-only role IT

* test: probe search RBAC on the asset index, not the domain index

* test: prove bot search scoping with a deny rule, not domains

* gitarbot feedback: include team ids in the RBAC query cache key

(cherry picked from commit dda6a92)

* fix(search): embed ElasticSearch semantic search queries as queries, not documents (#32553)

(cherry picked from commit ce2a1c1)

* fix(ingestion): use HTTP transport for MCP connector (#32342)

* fix(ingestion): use HTTP transport for MCP connector

* Update generated TypeScript types and dereferenced schemas

* chore: prune obsolete G004 baseline entries

* fix(ingestion): complete MCP HTTP transport support

* style(ingestion): format MCP transport client

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
(cherry picked from commit c45f71a)

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

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

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.

ElasticSearch semantic search embeds the query as a document

3 participants