Skip to content

Fixes #32546: Fix find_context and search_company_context on Elasticsearch - #32547

Closed
jfmlima wants to merge 1 commit into
open-metadata:mainfrom
jfmlima:fix/mcp-context-tools-elasticsearch
Closed

jfmlima wants to merge 1 commit into
open-metadata:mainfrom
jfmlima:fix/mcp-context-tools-elasticsearch

Conversation

@jfmlima

@jfmlima jfmlima commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #32546

AIContextFinder.searchKnowledge and CompanyContextTool resolved the vector service through OpenSearchVectorService.getInstance(), which is null on Elasticsearch deployments, so find_context and search_company_context returned nothing on Elasticsearch even with semantic search enabled and the entity vector index populated. Both call sites only use methods declared on VectorIndexService, so they now resolve the service through Entity.getSearchRepository().getVectorIndexService(), as SemanticSearchTool already does. No behaviour change on OpenSearch: the repository returns the same OpenSearchVectorService instance there.

AIContextBuilder and GetEntityTool keep the OpenSearch singleton because they need searchChunksByParent, which ElasticSearchVectorService does not implement.

Type of change:

  • Bug fix

High-level design:

N/A, small change.

Tests:

Use cases covered

  • On an Elasticsearch deployment with semantic search enabled, find_context returns approved glossary terms and their candidate assets for a business question.
  • On the same deployment, search_company_context executes the vector query instead of reporting the service as uninitialised.
  • OpenSearch deployments are unaffected.

Unit tests

  • No new tests: the change swaps a service lookup for the existing backend-agnostic accessor, and existing tests for AIContextFinder do not depend on the singleton.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

…rch repository in find_context and search_company_context

OpenSearchVectorService.getInstance() is null on Elasticsearch deployments, so both MCP tools returned nothing there. Both call sites only use methods declared on VectorIndexService, which SearchRepository exposes for either backend.
@jfmlima
jfmlima requested a review from a team as a code owner September 3, 2026 09:12
@gitar-bot

gitar-bot Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

Fixes find_context and search_company_context on Elasticsearch by resolving the vector service through the search repository instead of the OpenSearch singleton, which is null on Elasticsearch deployments. 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 Sep 3, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP find_context and search_company_context return no results on Elasticsearch even with semantic search enabled

1 participant