Skip to content

Commit f7f078e

Browse files
authored
Merge branch 'opensearch-project:main' into main
2 parents cfce568 + 158ada0 commit f7f078e

2 files changed

Lines changed: 113 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66
### Added
77
- Publish opensearch-protos python package to PyPi. ([#183](https://github.com/opensearch-project/opensearch-protobufs/pull/183))
88
- Proto Convertion tooling support null value ([#189](https://github.com/opensearch-project/opensearch-protobufs/pull/189))
9+
- Add `geo_distance` and `geo_bounding_box` to QueryContainer. ([#188](https://github.com/opensearch-project/opensearch-protobufs/pull/188))
910

1011
### Changed
1112
- update `score` protobuf type ([#179](https://github.com/opensearch-project/opensearch-protobufs/pull/179))

protos/schemas/common.proto

Lines changed: 112 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,23 @@ enum SourceType {
137137
}
138138

139139
message GeoLocation {
140-
141140
oneof geo_location {
142-
LatLonGeoLocation lat_lon_geo_location = 1;
143-
GeoHashLocation geo_hash_location = 2;
144-
NumberArray number_array = 3;
141+
// The location specified using latitude and longitude coordinates.
142+
LatLonGeoLocation latlon = 1;
143+
144+
// The location specified using a geohash value.
145+
GeoHashLocation geohash = 2;
146+
147+
DoubleArray double_array = 3;
148+
149+
// The location specified as a string in `lat,lon` or WKT format.
150+
string text = 4;
145151
}
152+
}
146153

154+
message DoubleArray {
155+
// The location specified as an array of `[longitude, latitude]`.
156+
repeated double double_array = 1;
147157
}
148158

149159
message NumberArray {
@@ -153,16 +163,16 @@ message NumberArray {
153163
}
154164

155165
message LatLonGeoLocation {
156-
// Latitude
166+
// [required] Latitude
157167
double lat = 1;
158168

159-
// Longitude
169+
// [required] Longitude
160170
double lon = 2;
161171

162172
}
163173

164174
message GeoHashLocation {
165-
175+
// [required]
166176
string geohash = 1;
167177

168178
}
@@ -456,9 +466,104 @@ message QueryContainer {
456466

457467
// The nested query acts as a wrapper for other queries to search nested fields. The nested field objects are searched as though they were indexed as separate documents. If an object matches the search, the nested query returns the parent document at the root level.
458468
NestedQuery nested = 28;
469+
470+
// A geodistance query returns documents with geopoints that are within a specified distance from the provided geopoint. A document with multiple geopoints matches the query if at least one geopoint matches the query.
471+
GeoDistanceQuery geo_distance = 29;
472+
473+
// To search for documents that contain geopoint fields, use a geo-bounding box query. The geo-bounding box query returns documents whose geopoints are within the bounding box specified in the query. A document with multiple geopoints matches the query if at least one geopoint is within the bounding box.
474+
GeoBoundingBoxQuery geo_bounding_box = 30;
475+
}
476+
}
477+
478+
message GeoBoundingBoxQuery {
479+
// [optional] Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.
480+
optional float boost = 1;
481+
// [optional] The name of the filter.
482+
optional string x_name = 2;
483+
// [optional]
484+
optional GeoExecution type = 3;
485+
// [optional] The validation method. Valid values are IGNORE_MALFORMED (accept geopoints with invalid coordinates), COERCE (try to coerce coordinates to valid values), and STRICT (return an error when coordinates are invalid). Default is STRICT.
486+
optional GeoValidationMethod validation_method = 4;
487+
// [optional] Specifies whether to ignore an unmapped field. If set to true, the query does not return any documents that have an unmapped field. If set to false, an exception is thrown when the field is unmapped. Default is false.
488+
optional bool ignore_unmapped = 5;
489+
// [optional]
490+
map<string, GeoBounds> bounding_box = 6;
491+
}
492+
493+
message GeoBounds {
494+
oneof geo_bounds {
495+
// The bounds specified using coordinate values.
496+
CoordsGeoBounds coords = 1;
497+
498+
// The bounds specified using upper-left and lower-right points.
499+
TopLeftBottomRightGeoBounds tlbr = 2;
500+
501+
// The bounds specified using upper-right and lower-left points.
502+
TopRightBottomLeftGeoBounds trbl = 3;
503+
504+
// The bounds specified using WKT format.
505+
WktGeoBounds wkt = 4;
459506
}
460507
}
461508

509+
message WktGeoBounds {
510+
// [required] The WKT string representation of the geographical bounds.
511+
string wkt = 1;
512+
}
513+
514+
message CoordsGeoBounds {
515+
// [required] The top boundary latitude.
516+
double top = 1;
517+
518+
// [required] The bottom boundary latitude.
519+
double bottom = 2;
520+
521+
// [required] The left boundary longitude.
522+
double left = 3;
523+
524+
// [required] The right boundary longitude.
525+
double right = 4;
526+
}
527+
528+
message TopLeftBottomRightGeoBounds {
529+
// [required] The upper-left corner coordinates.
530+
GeoLocation top_left = 1;
531+
532+
// [required] The lower-right corner coordinates.
533+
GeoLocation bottom_right = 2;
534+
}
535+
536+
message TopRightBottomLeftGeoBounds {
537+
// [required] The upper-right corner coordinates.
538+
GeoLocation top_right = 1;
539+
540+
// [required] The lower-left corner coordinates.
541+
GeoLocation bottom_left = 2;
542+
}
543+
544+
enum GeoExecution {
545+
GEO_EXECUTION_UNSPECIFIED = 0;
546+
GEO_EXECUTION_INDEXED = 1;
547+
GEO_EXECUTION_MEMORY = 2;
548+
}
549+
550+
message GeoDistanceQuery {
551+
// [optional] Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.
552+
optional float boost = 1;
553+
// [optional] The name of the filter.
554+
optional string x_name = 2;
555+
// [required] The distance within which to match the points. This distance is the radius of a circle centered at the specified point. For supported distance units, see Distance units.
556+
string distance = 3;
557+
// [optional] Specifies how to calculate the distance. Valid values are arc or plane (faster but inaccurate for long distances or points close to the poles).
558+
optional GeoDistanceType distance_type = 4;
559+
// [optional] The validation method. Valid values are IGNORE_MALFORMED (accept geopoints with invalid coordinates), COERCE (try to coerce coordinates to valid values), and STRICT (return an error when coordinates are invalid). Default is STRICT.
560+
optional GeoValidationMethod validation_method = 5;
561+
// [optional] 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.
562+
optional bool ignore_unmapped = 6;
563+
// [optional]
564+
map<string, GeoLocation> location = 7;
565+
}
566+
462567
message TermsQuery {
463568
// [optional] Floating point number used to decrease or increase the relevance scores of the query. Boost values are relative to the default value of 1.0. A boost value between 0 and 1.0 decreases the relevance score. A value greater than 1.0 increases the relevance score.
464569
optional float boost = 1;

0 commit comments

Comments
 (0)