Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add adjust_pure_negative for bool queries #641

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add adjust_pure_negative api spec
Signed-off-by: Chenyang Ji <cyji@amazon.com>
  • Loading branch information
ansjcy committed Oct 24, 2024
commit cefc17c428dddb1b0f32df11ee90cd6258406b98
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -104,6 +104,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added `config_id` and `config_id_list` to `/_plugins/_notifications/configs` query parameters ([#594](https://github.com/opensearch-project/opensearch-api-specification/pull/594))
- Added a release workflow triggered on a tag ([#635](https://github.com/opensearch-project/opensearch-api-specification/pull/635))
- Added API spec for query insights plugin ([#625](https://github.com/opensearch-project/opensearch-api-specification/pull/625))
- Added API spec for `adjust_pure_negative` for bool queries ([#641](https://github.com/opensearch-project/opensearch-api-specification/pull/641))

### Changed

7 changes: 7 additions & 0 deletions spec/schemas/_common.query_dsl.yaml
Original file line number Diff line number Diff line change
@@ -270,6 +270,13 @@ components:
- type: array
items:
$ref: '#/components/schemas/QueryContainer'
adjust_pure_negative:
description: |-
Ensures correct behavior when a query contains only must_not clauses.
By default set to true, OpenSearch adds a match-all clause to ensure results are returned from Lucene, with the must_not conditions applied as filters.
If set to false, the query may return no results, as Lucene typically requires at least one positive condition.
type: boolean
default: true
QueryBase:
type: object
properties:
4 changes: 1 addition & 3 deletions spec/schemas/insights._common.yaml
Original file line number Diff line number Diff line change
@@ -137,8 +137,7 @@ components:
NOTE: This is a debugging tool and adds significant overhead to search execution.
type: boolean
query:
description: The query definition using the Query DSL.
type: object
$ref: '_common.query_dsl.yaml#/components/schemas/QueryContainer'
script_fields:
description: Retrieve a script evaluation (based on different fields) for each hit.
type: object
@@ -206,7 +205,6 @@ components:
type: array
items:
type: string
additionalProperties: true
Measurement:
type: object
properties:
13 changes: 13 additions & 0 deletions tests/plugins/query_insights/insights/top_queries.yaml
Original file line number Diff line number Diff line change
@@ -41,6 +41,19 @@ prologues:
terms:
field: director.raw

- path: /{index}/_search
parameters:
index: movies
method: GET
request:
payload:
query:
bool:
adjust_pure_negative: true
must:
match:
title: Drive

chapters:
- synopsis: Retrieve default top queries.
path: /_insights/top_queries
Loading