Skip to content

Commit

Permalink
Fix geo distance query and its test (#560)
Browse files Browse the repository at this point in the history
Co-authored-by: Theo N. Truong <[email protected]>
  • Loading branch information
kolchfa-aws and nhtruong authored Sep 9, 2024
1 parent 49f7d99 commit d279f4a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
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 query DSL `neural` field `query_image` set `contentEncoding` and `model_id` as optional ([#512](https://github.com/opensearch-project/opensearch-api-specification/pull/512))
- Fixed `knn` query specification ([#538](https://github.com/opensearch-project/opensearch-api-specification/pull/538))
- Fixed content-type for `/hot_threads` ([#543](https://github.com/opensearch-project/opensearch-api-specification/pull/543))
- Fixed `geo_distance` query spec ([#560](https://github.com/opensearch-project/opensearch-api-specification/pull/560))
- 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))
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 @@ -656,11 +656,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

0 comments on commit d279f4a

Please sign in to comment.