From 3dcced99f99f8374f0b0f56eaf9ccd813c31f796 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Tue, 10 Sep 2024 12:21:58 +1200 Subject: [PATCH] Fix terms query schema (#564) * Fix terms query schema Signed-off-by: Thomas Farr * Add changelog Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr --- CHANGELOG.md | 2 +- spec/schemas/_common.query_dsl.yaml | 42 +++++++++++++++-------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c48b84eac..0ced75260 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -85,7 +85,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added `AwarenessAttributeStats` to `/_cluster/health` ([#534](https://github.com/opensearch-project/opensearch-api-specification/pull/534)) - Added `cache_reserved_in_bytes` to `ClusterFileSystem` ([#534](https://github.com/opensearch-project/opensearch-api-specification/pull/534)) - Added `cluster_manager` to `ClusterNodeCount` ([#534](https://github.com/opensearch-project/opensearch-api-specification/pull/534)) -- Added support for `query` with `terms` in `_search` ([#546](https://github.com/opensearch-project/opensearch-api-specification/pull/546)) +- Added support for `query` with `terms` in `_search` ([#546](https://github.com/opensearch-project/opensearch-api-specification/pull/546))([#564](https://github.com/opensearch-project/opensearch-api-specification/pull/564)) - Added `h`, `bytes`, `time` parameters to cat API tests ([#551](https://github.com/opensearch-project/opensearch-api-specification/pull/551)) - Added `terminated_early` to `count@200` ([#547](https://github.com/opensearch-project/opensearch-api-specification/pull/547)) - Added request and response schemas for `/_cluster/routing/awareness/{attribute}/weights` ([#524](https://github.com/opensearch-project/opensearch-api-specification/pull/524)) diff --git a/spec/schemas/_common.query_dsl.yaml b/spec/schemas/_common.query_dsl.yaml index c532ef260..c4852c848 100644 --- a/spec/schemas/_common.query_dsl.yaml +++ b/spec/schemas/_common.query_dsl.yaml @@ -190,7 +190,15 @@ components: minProperties: 1 maxProperties: 1 terms: - $ref: '#/components/schemas/TermsQuery' + type: object + additionalProperties: + anyOf: + - $ref: '#/components/schemas/TermsQuery' + - type: array + items: + type: string + minProperties: 1 + maxProperties: 1 terms_set: description: |- Returns documents that contain a minimum number of exact terms in a provided field. @@ -280,23 +288,6 @@ components: type: number _name: type: string - Terms: - oneOf: - - type: array - items: - type: string - - type: object - properties: - index: - $ref: '_common.yaml#/components/schemas/IndexName' - id: - $ref: '_common.yaml#/components/schemas/Id' - path: - $ref: '_common.yaml#/components/schemas/Field' - routing: - $ref: '_common.yaml#/components/schemas/Routing' - additionalProperties: true - description: Object for fetching terms. BoostingQuery: allOf: - $ref: '#/components/schemas/QueryBase' @@ -1891,7 +1882,16 @@ components: TermsQuery: anyOf: - $ref: '#/components/schemas/QueryBase' - - $ref: '#/components/schemas/Terms' + - type: object + properties: + index: + $ref: '_common.yaml#/components/schemas/IndexName' + id: + $ref: '_common.yaml#/components/schemas/Id' + path: + $ref: '_common.yaml#/components/schemas/Field' + routing: + $ref: '_common.yaml#/components/schemas/Routing' TermsSetQuery: allOf: - $ref: '#/components/schemas/QueryBase' @@ -1902,7 +1902,9 @@ components: minimum_should_match_script: $ref: '_common.yaml#/components/schemas/Script' terms: - $ref: '#/components/schemas/Terms' + type: array + items: + type: string required: - terms TextExpansionQuery: