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 geo distance query and its test #560

Merged
merged 3 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -145,6 +145,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 ([#560](https://github.com/opensearch-project/opensearch-api-specification/pull/560))

### Security

Expand Down
6 changes: 3 additions & 3 deletions spec/schemas/_common.query_dsl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -653,11 +653,11 @@ components:
$ref: '#/components/schemas/GeoValidationMethod'
ignore_unmapped:
$ref: '#/components/schemas/IgnoreUnmapped'
field:
type: object
additionalProperties:
$ref: '_common.yaml#/components/schemas/GeoLocation'
minProperties: 2
required:
- distance
- field
GeoPolygonQuery:
allOf:
- $ref: '#/components/schemas/QueryBase'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
$schema: ../../../../json_schemas/test_story.schema.yaml
$schema: ../../../../../json_schemas/test_story.schema.yaml

description: Test search endpoint with geo_distance query.
prologues:
- path: /map
- path: /cinemas
method: PUT
request:
payload:
mappings:
properties:
field:
location:
type: geo_point
- path: /map/_doc/1
- path: /cinemas/_doc/1
method: POST
parameters:
refresh: true
request:
payload:
field:
location:
lat: 74
lon: 40.71
status: [201]
epilogues:
- path: /map
- path: /cinemas
method: DELETE
status: [200, 404]
chapters:
- synopsis: Search for documents whose point objects are within the specified distance from the specified point.
path: /{index}/_search
parameters:
index: map
index: cinemas
method: GET
request:
payload:
Expand All @@ -38,7 +38,7 @@ chapters:
distance_type: arc
validation_method: strict
ignore_unmapped: true
field:
location:
lat: 73.5
lon: 40.5
response:
Expand All @@ -51,10 +51,10 @@ chapters:
relation: eq
max_score: 1
hits:
- _index: map
- _index: cinemas
_score: 1
_source:
field:
location:
lat: 74
lon: 40.71

Loading