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

Fix fuzzy query rewrite parameter and add test #561

Merged
merged 5 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed content-type for `/hot_threads` ([#543](https://github.com/opensearch-project/opensearch-api-specification/pull/543))
- Fixed `/_cluster/settings` returning flat results ([#545](https://github.com/opensearch-project/opensearch-api-specification/pull/545))
- Fixed missing fields in `_cat` API ([#551](https://github.com/opensearch-project/opensearch-api-specification/pull/551))
- Fixed `geo_distance` query spec ([#561](https://github.com/opensearch-project/opensearch-api-specification/pull/561))
- Fixed `geo_bounding_box` and `geo_shape` queries ([#531](https://github.com/opensearch-project/opensearch-api-specification/pull/531))

### Security
Expand Down
7 changes: 7 additions & 0 deletions spec/schemas/_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,13 @@ components:
- id
MultiTermQueryRewrite:
type: string
enum:
- constant_score
- constant_score_boolean
- scoring_boolean
- top_terms_N
- top_terms_blended_freqs_N
- top_terms_boost_N
Fuzziness:
oneOf:
- type: string
Expand Down
56 changes: 56 additions & 0 deletions tests/default/_core/search/query/fuzzy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
$schema: ../../../../../json_schemas/test_story.schema.yaml

description: Test search endpoint with fuzzy query.
prologues:
- path: /movies
method: PUT
request:
payload:
mappings:
properties:
title:
type: text
- path: /movies/_doc/1
method: POST
parameters:
refresh: true
request:
payload:
title: Brave
status: [201]
epilogues:
- path: /movies
method: DELETE
status: [200, 404]
chapters:
- synopsis: Search for documents using a fuzzy query.
path: /{index}/_search
parameters:
index: movies
method: GET
request:
payload:
query:
fuzzy:
title:
value: bake
fuzziness: 2
max_expansions: 40
prefix_length: 0
transpositions: true
rewrite: constant_score
response:
status: 200
payload:
timed_out: false
hits:
total:
value: 1
relation: eq
max_score: 1
hits:
- _index: movies
_score: 1
_source:
title: Brave

Loading