-
Notifications
You must be signed in to change notification settings - Fork 508
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 7507-collapse-search-results
- Loading branch information
Showing
18 changed files
with
573 additions
and
45 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
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,43 @@ | ||
name: PR Checklist | ||
|
||
on: | ||
pull_request: | ||
types: [opened] | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
add-checklist: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Comment PR with checklist | ||
uses: peter-evans/create-or-update-comment@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: | | ||
Thank you for submitting your PR. The PR states are In progress (or Draft) -> Tech review -> Doc review -> Editorial review -> Merged. | ||
Before you submit your PR for doc review, make sure the content is technically accurate. If you need help finding a tech reviewer, tag a [maintainer](https://github.com/opensearch-project/documentation-website/blob/main/MAINTAINERS.md). | ||
**When you're ready for doc review, tag the assignee of this PR**. The doc reviewer may push edits to the PR directly or leave comments and editorial suggestions for you to address (let us know in a comment if you have a preference). The doc reviewer will arrange for an editorial review. | ||
- name: Auto assign PR to repo owner | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
let assignee = context.payload.pull_request.user.login; | ||
const prOwners = ['Naarcha-AWS', 'kolchfa-aws', 'vagimeli', 'natebower']; | ||
if (!prOwners.includes(assignee)) { | ||
assignee = 'hdhalter' | ||
} | ||
github.rest.issues.addAssignees({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
assignees: [assignee] | ||
}); |
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 |
---|---|---|
|
@@ -4,4 +4,5 @@ _site | |
.DS_Store | ||
Gemfile.lock | ||
.idea | ||
*.iml | ||
.jekyll-cache |
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 |
---|---|---|
|
@@ -100,10 +100,10 @@ Follow these steps to set up your local copy of the repository: | |
|
||
#### Troubleshooting | ||
|
||
If you encounter an error while trying to build the documentation website, find the error in the following troubleshooting list: | ||
Try the following troubleshooting steps if you encounter an error when trying to build the documentation website: | ||
|
||
- When running `rvm install 3.2` if you receive a `Error running '__rvm_make -j10'`, resolve this by running `rvm install 3.2.0 -C --with-openssl-dir=/opt/homebrew/opt/[email protected]` instead of `rvm install 3.2`. | ||
- If receive a `bundle install`: `An error occurred while installing posix-spawn (0.3.15), and Bundler cannot continue.` error when trying to run `bundle install`, resolve this by running `gem install posix-spawn -v 0.3.15 -- --with-cflags=\"-Wno-incompatible-function-pointer-types\"`. Then, run `bundle install`. | ||
- If you see the `Error running '__rvm_make -j10'` error when running `rvm install 3.2`, you can resolve it by running `rvm install 3.2.0 -C --with-openssl-dir=/opt/homebrew/opt/[email protected]` instead of `rvm install 3.2`. | ||
- If you see the `bundle install`: `An error occurred while installing posix-spawn (0.3.15), and Bundler cannot continue.` error when trying to run `bundle install`, you can resolve it by running `gem install posix-spawn -v 0.3.15 -- --with-cflags=\"-Wno-incompatible-function-pointer-types\"` and then `bundle install`. | ||
|
||
|
||
|
||
|
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
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
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
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,177 @@ | ||
--- | ||
layout: default | ||
title: Geopolygon | ||
parent: Geographic and xy queries | ||
grand_parent: Query DSL | ||
nav_order: 30 | ||
--- | ||
|
||
# Geopolygon query | ||
|
||
A geopolygon query returns documents containing geopoints that are within the specified polygon. A document containing multiple geopoints matches the query if at least one geopoint matches the query. | ||
|
||
A polygon is specified by a list of vertices in coordinate form. Unlike specifying a polygon for a geoshape field, the polygon does not have to be closed (specifying the first and last points at the same is unnecessary). Though points do not have to follow either clockwise or counterclockwise order, it is recommended that you list them in either of these orders. This will ensure that the correct polygon is captured. | ||
|
||
The searched document field must be mapped as `geo_point`. | ||
{: .note} | ||
|
||
## Example | ||
|
||
Create a mapping with the `point` field mapped as `geo_point`: | ||
|
||
```json | ||
PUT /testindex1 | ||
{ | ||
"mappings": { | ||
"properties": { | ||
"point": { | ||
"type": "geo_point" | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
Index a geopoint, specifying its latitude and longitude: | ||
|
||
```json | ||
PUT testindex1/_doc/1 | ||
{ | ||
"point": { | ||
"lat": 73.71, | ||
"lon": 41.32 | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
Search for documents whose `point` objects are within the specified `geo_polygon`: | ||
|
||
```json | ||
GET /testindex1/_search | ||
{ | ||
"query": { | ||
"bool": { | ||
"must": { | ||
"match_all": {} | ||
}, | ||
"filter": { | ||
"geo_polygon": { | ||
"point": { | ||
"points": [ | ||
{ "lat": 74.5627, "lon": 41.8645 }, | ||
{ "lat": 73.7562, "lon": 42.6526 }, | ||
{ "lat": 73.3245, "lon": 41.6189 }, | ||
{ "lat": 74.0060, "lon": 40.7128 } | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
The polygon specified in the preceding request is the quadrilateral depicted in the following image. The matching document is within this quadrilateral. The coordinates of the quadrilateral vertices are specified in `(latitude, longitude)` format. | ||
|
||
![Search for points within the specified quadrilateral]({{site.url}}{{site.baseurl}}/images/geopolygon-query.png) | ||
|
||
The response contains the matching document: | ||
|
||
```json | ||
{ | ||
"took": 6, | ||
"timed_out": false, | ||
"_shards": { | ||
"total": 1, | ||
"successful": 1, | ||
"skipped": 0, | ||
"failed": 0 | ||
}, | ||
"hits": { | ||
"total": { | ||
"value": 1, | ||
"relation": "eq" | ||
}, | ||
"max_score": 1, | ||
"hits": [ | ||
{ | ||
"_index": "testindex1", | ||
"_id": "1", | ||
"_score": 1, | ||
"_source": { | ||
"point": { | ||
"lat": 73.71, | ||
"lon": 41.32 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
In the preceding search request, you specified the polygon vertices in clockwise order: | ||
|
||
```json | ||
"geo_polygon": { | ||
"point": { | ||
"points": [ | ||
{ "lat": 74.5627, "lon": 41.8645 }, | ||
{ "lat": 73.7562, "lon": 42.6526 }, | ||
{ "lat": 73.3245, "lon": 41.6189 }, | ||
{ "lat": 74.0060, "lon": 40.7128 } | ||
] | ||
} | ||
} | ||
``` | ||
|
||
Alternatively, you can specify the vertices in counterclockwise order: | ||
|
||
```json | ||
"geo_polygon": { | ||
"point": { | ||
"points": [ | ||
{ "lat": 74.5627, "lon": 41.8645 }, | ||
{ "lat": 74.0060, "lon": 40.7128 }, | ||
{ "lat": 73.3245, "lon": 41.6189 }, | ||
{ "lat": 73.7562, "lon": 42.6526 } | ||
] | ||
} | ||
} | ||
``` | ||
|
||
The resulting query response contains the same matching document. | ||
|
||
However, if you specify the vertices in the following order: | ||
|
||
```json | ||
"geo_polygon": { | ||
"point": { | ||
"points": [ | ||
{ "lat": 74.5627, "lon": 41.8645 }, | ||
{ "lat": 74.0060, "lon": 40.7128 }, | ||
{ "lat": 73.7562, "lon": 42.6526 }, | ||
{ "lat": 73.3245, "lon": 41.6189 } | ||
] | ||
} | ||
} | ||
``` | ||
|
||
The response returns no results. | ||
|
||
## Request fields | ||
|
||
Geopolygon queries accept the following fields. | ||
|
||
Field | Data type | Description | ||
:--- | :--- | :--- | ||
`_name` | String | The name of the filter. Optional. | ||
`validation_method` | String | 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). Optional. Default is `STRICT`. | ||
`ignore_unmapped` | Boolean | Specifies whether to ignore an unmapped field. If set to `true`, then the query does not return any documents that contain an unmapped field. If set to `false`, then an exception is thrown when the field is unmapped. Optional. Default is `false`. | ||
|
||
## Accepted formats | ||
|
||
You can specify the geopoint coordinates when indexing a document and searching for documents in any [format]({{site.url}}{{site.baseurl}}/opensearch/supported-field-types/geo-point#formats) accepted by the geopoint field type. |
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
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.