Skip to content

Search silently returns 0 results on OpenSearch 3.3.2: shard failures are not surfaced #32255

Closed

Description

@lll86789

Affected module

Search / Discovery

Describe the bug

After upgrading from 1.13.1 to 2.0.0, global search returns zero results for every
query
, on the same OpenSearch cluster that worked before the upgrade and after a
full, successful reindex. The UI shows an ordinary "no results" state and the API
returns HTTP 200.

There are two distinct problems here, and the second matters more than the first.

1. 2.0's default searchSettings triggers a Lucene NPE on OpenSearch 3.3.2.

2.0 wraps the search term in a dis_max containing eight clauses — four
constant_score and four script_score:

[0] constant_score  ranking:exactName:displayName.keyword:0
[1] constant_score  ranking:phraseName:name
[2] constant_score  ranking:prefixName:name
[3] constant_score  ranking:closeName:token:0
[4] script_score    ranking:fuzzyName:text
[5] script_score    ranking:partialName:text
[6] script_score    ranking:structuralContext:text
[7] script_score    ranking:descriptionContext:text

all with script.source = params.weight * _score / (_score + params.pivot).

On Lucene 10.3.1 (OpenSearch 3.3.2), two or more script_score clauses in the same
disjunction throw a NullPointerException during the query phase. 1.13.1 did not
generate this shape against the same cluster, which is why the upgrade is what
surfaced it.

2. OpenMetadata ignores _shards.failed and reports the failure as an empty
result.

The shards that throw are exactly the ones holding data; the empty indices succeed.
OpenMetadata discards _shards.failed and returns the partial — here, empty — hit
list with a 200:

"_shards": { "total": 24, "successful": 19, "skipped": 0, "failed": 5 },
"hits":    { "total": { "value": 0 } }

Each failure is:

{ "index": "table_search_index", "shard": 0,
  "reason": { "type": "null_pointer_exception", "reason": null } }

Nothing is logged. The OpenMetadata server log contains zero WARN and zero ERROR
entries for these requests, and the OpenSearch node log contains no exception either.
The UI, the API status code, and both logs all look normal, so a broken search engine
and a genuinely empty index are indistinguishable from the operator's side.

This is what turned a version bump into a day of debugging: the only natural next step
is "the reindex must have failed, run it again", which is wrong and costs another hour
each time.

To Reproduce

The symptom, as seen in a real deployment

The clearest signal is that querying OpenSearch directly works while querying
through OpenMetadata does not
— same alias, same data, same instant.

# Direct URI query against the alias OpenMetadata itself searches
$ curl 'localhost:9200/dataAsset/_search?q=om_test'
"_shards": { "total": 24, "successful": 24, "skipped": 0, "failed": 0 }
"hits":    { "total": { "value": 4 } }

# The DSL query OpenMetadata generates for the same term, replayed verbatim
$ curl 'localhost:9200/dataAsset/_search' -d @om-generated-query.json
"_shards": { "total": 24, "successful": 19, "skipped": 0, "failed": 5 }
"hits":    { "total": { "value": 0 } }

The five failing indices are exactly the five that contain data:

column_search_index            null_pointer_exception
database_schema_search_index   null_pointer_exception
database_search_index          null_pointer_exception
table_search_index             null_pointer_exception
tag_search_index               null_pointer_exception

The other 19 are empty in this deployment and succeed. The failure count therefore
scales with how much of the catalog is populated, and the outcome is always the same:
everything that could have matched is in a shard that threw. Confirmed for every term
tried — om, om_test, and two others — all failed=5/24, hits=0.

To capture the outgoing query for replay:

curl -XPUT 'localhost:9200/_all/_settings' -H 'Content-Type: application/json' \
  -d '{"index.search.slowlog.threshold.query.warn":"0ms"}'
# search once in the UI, then read the `source[...]` payload from the OpenSearch log

Minimal reproduction, no OpenMetadata required

docker run -d --name os -p 9200:9200 \
  -e discovery.type=single-node -e DISABLE_SECURITY_PLUGIN=true \
  opensearchproject/opensearch:3.3.2

curl -XPUT 'localhost:9200/repro' -H 'Content-Type: application/json' \
  -d '{"settings":{"number_of_shards":1,"number_of_replicas":0}}'
curl -XPOST 'localhost:9200/repro/_doc?refresh=true' -H 'Content-Type: application/json' \
  -d '{"name":"om_test"}'

# two script_score clauses in one dis_max -> HTTP 500, null_pointer_exception
curl 'localhost:9200/repro/_search?size=1' -H 'Content-Type: application/json' -d '{
  "query": {"dis_max": {"queries": [
    {"script_score": {"query": {"match": {"name": "om_test"}}, "script": {"source": "_score"}}},
    {"script_score": {"query": {"match": {"name": "om"}},      "script": {"source": "_score"}}}
  ]}}}'

Drop either script_score and the same query returns 1 hit with failed: 0.

What actually triggers it

Measured on OpenSearch 3.3.2 against the one-document index above:

query shape result
bool.should: script_score + match OK, 1 hit
bool.should: script_score × 2 NPE
dis_max: script_score × 1 OK, 1 hit
dis_max: script_score × 2 NPE
dis_max: constant_score + script_score OK, 1 hit
dis_max: match × 2 OK, 1 hit

The count of script_score clauses is what matters — not the number of clauses in the
disjunction, and not the container type; bool.should and dis_max behave
identically. A single script_score alongside any number of ordinary clauses is fine.

Version check

Same document, same query:

OpenSearch Lucene dis_max with 2× script_score
3.3.2 10.3.1 NPE, HTTP 500
3.4.0 10.3.2 OK, failed: 0, 1 hit

I did not test 3.3.0 or 3.3.1, so I cannot say where the regression starts — only that
3.3.2 is broken and 3.4.0 is not.

Two notes that may save time

  • size: 0 gives a false negative. Scoring is skipped, the failing scorer is never
    reached, and the query appears to work. Bisect with size: 1.
  • Under a stock image the top of the stack points at
    org.opensearch.neuralsearch...HybridQueryPhaseSearcher. That plugin is only a
    query-phase wrapper and is not the cause; semantic search was disabled throughout.

Expected behavior

A search that fails should not be able to look like a search that found nothing.

When the search response reports _shards.failed > 0, OpenMetadata should:

  • Log the shard failure reasons at WARN/ERROR. A single line naming
    null_pointer_exception and the affected index would have pointed straight at the
    query engine instead of at the reindex.
  • Return a non-200, or attach an explicit warning to the response, when
    _shards.failed > 0 — particularly when successful < total and hits.total
    is 0, which cannot be a legitimate result.
  • Surface it in the UI as a search backend error rather than an empty state.

Separately, since 2.0's own default search configuration makes search completely
non-functional on 3.3.2, the documented OpenSearch recommendation should not point at
3.3.x. The docs currently list 3.x with a 3.0.0 minimum and 3.3.0 recommended.

OS

Ubuntu 24.04.2 LTS (WSL2 on Windows 11, kernel 6.6.87.2-microsoft-standard-WSL2) Kubernetes: k3d / k3s v1.31.5

Python version

N/A — server-side search only; no ingestion involved in this bug.

OpenMetadata version

2.0.0 (Helm chart 2.0.0, docker.getcollate.io/openmetadata/server:2.0.0) Upgraded from 1.13.1, where search worked on the same OpenSearch cluster.

OpenMetadata Ingestion package version

N/A — not involved. Ingestion image is docker.getcollate.io/openmetadata/ingestion-base:2.0.0 and pipelines run normally.

Additional context

Deployment

Search backend OpenSearch 3.3.2 (Lucene 10.3.1), single node, security plugin disabled
Metadata DB PostgreSQL 17.11 (CloudNativePG)
Orchestrator K8s native orchestrator (OMJob operator), no Airflow
Previous version 1.13.1 on the same OpenSearch 3.3.2 cluster — search worked

The OpenSearch version did not change across the upgrade. Only OpenMetadata did.

The reindex is not the problem. Post-upgrade reindex --force completed cleanly:
every index promoted (allPromoted=true), 0 orphaned rebuild indices, and the
documents are directly queryable as shown above.

Workaround: upgrade OpenSearch to 3.4.0. No reindex is required — the documents
were never the problem, only query execution.

Trimming a single ranking rule is not sufficient. I removed
ranking:fuzzyName:text from the generated query and replayed it: still
failed=5/24, hits=0, because three script_score clauses remain and two is enough to
trigger it. Removing all four script_score rules does restore results
(failed=0/24, hits=1), at the cost of the ranking they provide.

Pre-submission checklist

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

Activity

  1. mikemikimike commented on Aug 29, 2026

    @mikemikimike

    I opened #32257 to address the silent partial-search failure. The OpenSearch search path now detects responses with failed shards, logs the affected index and count, and raises a SearchException instead of returning HTTP 200 with a misleading empty result. I also added offline regression coverage for zero-failure and partial-failure responses. The local focused Maven test was attempted but the repository's reactor modules were unavailable in the filtered checkout; remote CI is running the complete build.

  2. moved this to In Review / QA 👀 in Shippingon Sep 8, 2026
  3. self-assigned this
    on Sep 8, 2026
  4. added a commit that references this issue on Sep 8, 2026
    e84cd68
  5. moved this from In Review / QA 👀 to Done ✅ in Shippingon Sep 9, 2026
  6. added a commit that references this issue on Sep 10, 2026
    5301acf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

  • Status
    Done ✅
  • Status
    Done ✅

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions