opensearch-project/OpenSearch

[BUG] mandatory parameters in terms_set

Open

#18.261 geöffnet am 12. Mai 2025

Auf GitHub ansehen
 (11 Kommentare) (0 Reaktionen) (2 zugewiesene Personen)Java (1.505 Forks)batch import
Searchbuggood first issue

Repository-Metriken

Stars
 (8.123 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 5T 9h) (266 gemergte PRs in 30 T)

Beschreibung

Hello

It seems that the terms_set documentation ( https://docs.opensearch.org/docs/latest/query-dsl/term/terms-set/ ) is wrong when it states:

The < field > accepts the following parameters. All parameters except < terms > are optional.

If I write this query:

GET /XXX/_search { "query": { "bool": { "must": [ { "terms_set": { "provider": { "terms": [ 1,2 ] } } } ] } }, "size": 100, "version": true }

I get:

{ "error": { "root_cause": [ { "type": "query_shard_exception", "reason": "failed to create query: No minimum should match has been specified", "index": "XXX", "index_uuid": "HuMh0VE4STKSBT4eCUIYNA" } ], "type": "search_phase_execution_exception", "reason": "all shards failed", "phase": "query", "grouped": true, "failed_shards": [ { "shard": 0, "index": "XXX", "node": "_ok60ix0RgmSTq4OLV6wxw", "reason": { "type": "query_shard_exception", "reason": "failed to create query: No minimum should match has been specified", "index": "XXX", "index_uuid": "HuMh0VE4STKSBT4eCUIYNA", "caused_by": { "type": "illegal_state_exception", "reason": "No minimum should match has been specified" } } } ] }, "status": 400 }

I suppose that exactly one option among minimum_should_match_field and minimum_should_match_script is expected . Both being set would be strange.

Related component

No response

To Reproduce

See my example

Expected behavior

The result should not complain or the documentation is wrong.

Additional Details

No response

Contributor Guide