Skip to content

Commit

Permalink
Add geodistance query test
Browse files Browse the repository at this point in the history
Signed-off-by: Fanit Kolchina <[email protected]>
  • Loading branch information
kolchfa-aws committed Jul 16, 2024
1 parent 188413c commit fec9244
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spec/schemas/_common.query_dsl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,16 @@ components:
$ref: '_common.yaml#/components/schemas/GeoDistanceType'
validation_method:
$ref: '#/components/schemas/GeoValidationMethod'
ignore_unmapped:
description: |-
Set to `true` to ignore an unmapped field and not match any documents for this query.
Set to `false` to throw an exception if the field is not mapped.
type: boolean
field:
type: object

Check failure on line 634 in spec/schemas/_common.query_dsl.yaml

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 14 spaces but found 16 spaces
required:
- distance
- field
GeoPolygonQuery:
allOf:
- $ref: '#/components/schemas/QueryBase'
Expand Down
60 changes: 60 additions & 0 deletions tests/_core/geodistance_query.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
$schema: ../../json_schemas/test_story.schema.yaml

description: Test search endpoint with geodistance query.

Check failure on line 3 in tests/_core/geodistance_query.yaml

View workflow job for this annotation

GitHub Actions / lint

Unknown word: "geodistance"
prologues:
- path: /testindex1

Check failure on line 5 in tests/_core/geodistance_query.yaml

View workflow job for this annotation

GitHub Actions / lint

Unknown word: "testindex"
method: PUT
request_body:
payload:
mappings:
properties:
field:
type: geo_point
- path: /testindex1/_doc/1

Check failure on line 13 in tests/_core/geodistance_query.yaml

View workflow job for this annotation

GitHub Actions / lint

Unknown word: "testindex"
method: POST
parameters:
refresh: true
request_body:
payload:
field:
lat: 74.00

Check failure on line 20 in tests/_core/geodistance_query.yaml

View workflow job for this annotation

GitHub Actions / lint

Trailing zeros are not allowed, fix to `74`
lon: 40.71
status: [201]
epilogues:
- path: /testindex1

Check failure on line 24 in tests/_core/geodistance_query.yaml

View workflow job for this annotation

GitHub Actions / lint

Unknown word: "testindex"
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: testindex1

Check failure on line 31 in tests/_core/geodistance_query.yaml

View workflow job for this annotation

GitHub Actions / lint

Unknown word: "testindex"
method: GET
request_body:
payload:
query:
geo_distance:
distance: "50mi"

Check failure on line 37 in tests/_core/geodistance_query.yaml

View workflow job for this annotation

GitHub Actions / lint

Must use plain style scalar

Check failure on line 37 in tests/_core/geodistance_query.yaml

View workflow job for this annotation

GitHub Actions / lint

Strings must use singlequote
distance_type: "arc"

Check failure on line 38 in tests/_core/geodistance_query.yaml

View workflow job for this annotation

GitHub Actions / lint

Must use plain style scalar
validation_method: "strict"
ignore_unmapped: true
field:
lat: 73.5
lon: 40.5
response:
status: 200
payload:
timed_out: false
hits:
total:
value: 1
relation: eq
max_score: 1
hits:
- _index: testindex1
_score: 1
_source:
field:
lat: 74
lon: 40.71

0 comments on commit fec9244

Please sign in to comment.