opensearch-project/OpenSearch

[BUG] mandatory parameters in terms_set

Open

#18,261 创建于 2025年5月12日

在 GitHub 查看
 (11 评论) (0 反应) (2 负责人)Java (8,123 star) (1,505 fork)batch import
Searchbuggood first issue

描述

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

贡献者指南