forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support of GeoJson Point for GeoPoint field (opensearch-project#4597)
* Support of GeoJson Point for GeoPoint field See opensearch-project/geospatial#152 Signed-off-by: Heemin Kim <[email protected]> * Refactored code based on comments Signed-off-by: Heemin Kim <[email protected]> * Add unit tests for GeoJson support Signed-off-by: Heemin Kim <[email protected]> * Resolve comments * Remove negation expression * Ignore case for GeoJson Point type to be consistent with geo_shape parsing Signed-off-by: Heemin Kim <[email protected]> * Added yaml test for geopoint Signed-off-by: Heemin Kim <[email protected]> Signed-off-by: Heemin Kim <[email protected]>
- Loading branch information
Showing
8 changed files
with
523 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
145 changes: 145 additions & 0 deletions
145
rest-api-spec/src/main/resources/rest-api-spec/test/index/80_geo_point.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
setup: | ||
- do: | ||
indices.create: | ||
index: test_1 | ||
body: | ||
settings: | ||
number_of_replicas: 0 | ||
mappings: | ||
properties: | ||
location: | ||
type: geo_point | ||
|
||
--- | ||
"Single point test": | ||
- do: | ||
bulk: | ||
refresh: true | ||
body: | ||
- index: | ||
_index: test_1 | ||
_id: 1 | ||
- location: | ||
lon: 52.374081 | ||
lat: 4.912350 | ||
- index: | ||
_index: test_1 | ||
_id: 2 | ||
- location: "4.901618,52.369219" | ||
- index: | ||
_index: test_1 | ||
_id: 3 | ||
- location: [ 52.371667, 4.914722 ] | ||
- index: | ||
_index: test_1 | ||
_id: 4 | ||
- location: "POINT (52.371667 4.914722)" | ||
- index: | ||
_index: test_1 | ||
_id: 5 | ||
- location: "t0v5zsq1gpzf" | ||
- index: | ||
_index: test_1 | ||
_id: 6 | ||
- location: | ||
type: Point | ||
coordinates: [ 52.371667, 4.914722 ] | ||
|
||
- do: | ||
search: | ||
index: test_1 | ||
rest_total_hits_as_int: true | ||
body: | ||
query: | ||
geo_shape: | ||
location: | ||
shape: | ||
type: "envelope" | ||
coordinates: [ [ 51, 5 ], [ 53, 3 ] ] | ||
|
||
- match: { hits.total: 6 } | ||
|
||
- do: | ||
search: | ||
index: test_1 | ||
rest_total_hits_as_int: true | ||
body: | ||
query: | ||
geo_shape: | ||
location: | ||
shape: | ||
type: "envelope" | ||
coordinates: [ [ 151, 15 ], [ 153, 13 ] ] | ||
|
||
- match: { hits.total: 0 } | ||
|
||
--- | ||
"Multi points test": | ||
- do: | ||
bulk: | ||
refresh: true | ||
body: | ||
- index: | ||
_index: test_1 | ||
_id: 1 | ||
- location: | ||
- {lon: 52.374081, lat: 4.912350} | ||
- {lon: 152.374081, lat: 14.912350} | ||
- index: | ||
_index: test_1 | ||
_id: 2 | ||
- location: | ||
- "4.901618,52.369219" | ||
- "14.901618,152.369219" | ||
- index: | ||
_index: test_1 | ||
_id: 3 | ||
- location: | ||
- [ 52.371667, 4.914722 ] | ||
- [ 152.371667, 14.914722 ] | ||
- index: | ||
_index: test_1 | ||
_id: 4 | ||
- location: | ||
- "POINT (52.371667 4.914722)" | ||
- "POINT (152.371667 14.914722)" | ||
- index: | ||
_index: test_1 | ||
_id: 5 | ||
- location: | ||
- "t0v5zsq1gpzf" | ||
- "x6skg0zbhnum" | ||
- index: | ||
_index: test_1 | ||
_id: 6 | ||
- location: | ||
- {type: Point, coordinates: [ 52.371667, 4.914722 ]} | ||
- {type: Point, coordinates: [ 152.371667, 14.914722 ]} | ||
|
||
- do: | ||
search: | ||
index: test_1 | ||
rest_total_hits_as_int: true | ||
body: | ||
query: | ||
geo_shape: | ||
location: | ||
shape: | ||
type: "envelope" | ||
coordinates: [ [ 51, 5 ], [ 53, 3 ] ] | ||
|
||
- match: { hits.total: 6 } | ||
|
||
- do: | ||
search: | ||
index: test_1 | ||
rest_total_hits_as_int: true | ||
body: | ||
query: | ||
geo_shape: | ||
location: | ||
shape: | ||
type: "envelope" | ||
coordinates: [ [ 151, 15 ], [ 153, 13 ] ] | ||
|
||
- match: { hits.total: 6 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.