Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spec for opensearch phone plugin. #610

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ jobs:
tests: routing
- version: 2.16.0
tests: snapshot
- version: 2.18.0
hub: opensearchstaging
ref: '@sha256:f311da085b968663fadf041bafc78b24dc21556f0726e625caf3560f7323a020'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove SHA, this is a released version.

tests: plugins/analysis
- version: 2.17.0
tests: plugins/streaming
- version: 2.17.0
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added `404` response for `DELETE /{index}`, `GET /{index}/_doc/{id}`, `DELETE /{index}/_doc/{id}` ([#589](https://github.com/opensearch-project/opensearch-api-specification/pull/589))
- Added ability to pass `InlineScript` as a simple string ([#605](https://github.com/opensearch-project/opensearch-api-specification/pull/605))
- Added `config_id` and `config_id_list` to `/_plugins/_notifications/configs` query parameters ([#594](https://github.com/opensearch-project/opensearch-api-specification/pull/594))
- Added documentation & test for `analysis-phonenumber` plugin ([#609](https://github.com/opensearch-project/opensearch-api-specification/pull/609))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Added documentation & test for `analysis-phonenumber` plugin ([#609](https://github.com/opensearch-project/opensearch-api-specification/pull/609))
- Added `PhoneAnalyzer` from `analysis-phonenumber` plugin ([#609](https://github.com/opensearch-project/opensearch-api-specification/pull/609))


### Changed

Expand Down Expand Up @@ -176,6 +177,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed inaccurate numeric type ([#597](https://github.com/opensearch-project/opensearch-api-specification/pull/597))([#598](https://github.com/opensearch-project/opensearch-api-specification/pull/598))([#600](https://github.com/opensearch-project/opensearch-api-specification/pull/600))
- Fixed mapping and analysis types ([#600](https://github.com/opensearch-project/opensearch-api-specification/pull/600))
- Fixed `RestStatus` responses in `DELETE /_plugins/_notifications/configs/{config_id}` ([#594](https://github.com/opensearch-project/opensearch-api-specification/pull/594))
- Fixed `GET /_snapshot_/{repository}/{snapshot}` ([#608](https://github.com/opensearch-project/opensearch-api-specification/pull/608))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems unrelated, rebase.


### Security

Expand Down
13 changes: 1 addition & 12 deletions spec/namespaces/snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -408,23 +408,12 @@ components:
schema:
type: object
properties:
responses:
type: array
items:
$ref: '../schemas/snapshot.get.yaml#/components/schemas/SnapshotResponseItem'
snapshots:
type: array
items:
$ref: '../schemas/snapshot._common.yaml#/components/schemas/SnapshotInfo'
total:
description: The total number of snapshots that match the request when ignoring size limit or after query parameter.
type: number
remaining:
description: The number of remaining snapshots that were not returned due to size limits and that can be fetched by additional requests using the next field value.
type: number
required:
- remaining
- total
- snapshots
snapshot.get_repository@200:
content:
application/json:
Expand Down
12 changes: 12 additions & 0 deletions spec/schemas/_common.analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ components:
- $ref: '#/components/schemas/DutchAnalyzer'
- $ref: '#/components/schemas/SmartcnAnalyzer'
- $ref: '#/components/schemas/CjkAnalyzer'
- $ref: '#/components/schemas/PhoneAnalyzer'
CustomAnalyzer:
type: object
properties:
Expand Down Expand Up @@ -367,6 +368,17 @@ components:
$ref: '#/components/schemas/StopWords'
stopwords_path:
type: string
PhoneAnalyzer:
type: object
properties:
type:
type: string
enum:
- phone
- phone-search
phone-region:
type: string
description: Optional ISO 3166 country code, defaults to "ZZ" (unknown region).
CharFilter:
oneOf:
- title: name
Expand Down
39 changes: 4 additions & 35 deletions spec/schemas/snapshot._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ components:
type: array
items:
$ref: '_common.yaml#/components/schemas/IndexName'
index_details:
type: object
additionalProperties:
$ref: '#/components/schemas/IndexDetails'
metadata:
$ref: '_common.yaml#/components/schemas/Metadata'
pinned_timestamp:
$ref: '_common.yaml#/components/schemas/EpochTimeUnitMillis'
reason:
type: string
repository:
$ref: '_common.yaml#/components/schemas/Name'
remote_store_index_shallow_copy:
type: boolean
snapshot:
$ref: '_common.yaml#/components/schemas/Name'
shards:
Expand All @@ -57,10 +55,6 @@ components:
$ref: '_common.yaml#/components/schemas/VersionString'
version_id:
$ref: '_common.yaml#/components/schemas/VersionNumber'
feature_states:
type: array
items:
$ref: '#/components/schemas/InfoFeatureState'
required:
- data_streams
- snapshot
Expand All @@ -83,31 +77,6 @@ components:
- reason
- shard_id
- status
IndexDetails:
type: object
properties:
shard_count:
type: number
size:
$ref: '_common.yaml#/components/schemas/HumanReadableByteCount'
size_in_bytes:
$ref: '_common.yaml#/components/schemas/ByteCount'
max_segments_per_shard:
type: number
required:
- max_segments_per_shard
- shard_count
- size_in_bytes
InfoFeatureState:
type: object
properties:
feature_name:
type: string
indices:
$ref: '_common.yaml#/components/schemas/Indices'
required:
- feature_name
- indices
Repository:
type: object
properties:
Expand Down
21 changes: 0 additions & 21 deletions spec/schemas/snapshot.get.yaml

This file was deleted.

9 changes: 9 additions & 0 deletions tests/plugins/analysis/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ARG OPENSEARCH_DOCKER_HUB_PROJECT
ARG OPENSEARCH_VERSION
ARG OPENSEARCH_DOCKER_REF

FROM ${OPENSEARCH_DOCKER_HUB_PROJECT}/opensearch:${OPENSEARCH_VERSION}${OPENSEARCH_DOCKER_REF}

# when updating, get the latest/corresponding stable URL with
# curl -v https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.18.0/latest/linux/x64/tar/builds/opensearch/core-plugins/analysis-phonenumber-2.18.0.zip
RUN ./bin/opensearch-plugin install https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.18.0/10380/linux/x64/tar/builds/opensearch/core-plugins/analysis-phonenumber-2.18.0.zip
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a permalink where we can use ${OPENSEARCH_VERSION} only without a build number? This way when we move from 2.18 to 2.19 it works without an update.

17 changes: 17 additions & 0 deletions tests/plugins/analysis/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3'

services:
opensearch-cluster:
build:
context: .
args:
- OPENSEARCH_DOCKER_HUB_PROJECT=${OPENSEARCH_DOCKER_HUB_PROJECT:-opensearchproject}
- OPENSEARCH_DOCKER_REF=${OPENSEARCH_DOCKER_REF}
- OPENSEARCH_VERSION=${OPENSEARCH_VERSION:-latest}
ports:
- 9200:9200
- 9600:9600
environment:
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_PASSWORD:-myStrongPassword123!}
- OPENSEARCH_JAVA_OPTS=${OPENSEARCH_JAVA_OPTS}
- discovery.type=single-node
36 changes: 36 additions & 0 deletions tests/plugins/analysis/indices/analyze/analyzer/phone.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
$schema: ../../../../../json_schemas/test_story.schema.yaml

description: Test /{index}/_analyze for the phone and phone-search analyzers.
prologues:
- path: /example-phone
method: PUT
request:
payload:
settings:
index:
analysis:
analyzer:
phone-ch:
type: phone
phone-region: CH
phone-search-ch:
type: phone-search
phone-region: CH
epilogues:
- path: /example-phone
method: DELETE
status: [200, 404]
chapters:
- synopsis: Analyze phone number.
path: /{index}/_analyze
method: POST
parameters:
index: example-phone
request:
payload:
text: +41 60 555 12 34
response:
status: 200
payload:
tokens:
- token: 605551234
79 changes: 79 additions & 0 deletions tests/snapshot/snapshot/snapshot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test _snapshot/{repository}/snapshot endpoints.
epilogues:
- path: /_snapshot/{repository}/{snapshot}
method: DELETE
status: [200, 404]
parameters:
repository: my-fs-repository
snapshot: my-test-snapshot
- path: /_snapshot/{repository}
method: DELETE
status: [200, 404]
parameters:
repository: my-fs-repository
prologues:
- path: /_snapshot/{repository}
method: PUT
parameters:
repository: my-fs-repository
request:
payload:
type: fs
settings:
location: /tmp/opensearch/repo
chapters:
- synopsis: Get information about a repository.
path: /_snapshot/{repository}
method: GET
parameters:
repository: my-fs-repository
response:
status: 200
payload:
my-fs-repository:
type: fs
settings:
location: /tmp/opensearch/repo
- synopsis: Create a snapshot.
path: /_snapshot/{repository}/{snapshot}
method: PUT
parameters:
repository: my-fs-repository
snapshot: my-test-snapshot
wait_for_completion: true
request:
payload:
indices: '*'
ignore_unavailable: true
include_global_state: false
partial: true
response:
status: 200
payload:
snapshot:
snapshot: my-test-snapshot
- synopsis: Get information about a snapshot.
path: /_snapshot/{repository}/{snapshot}
method: GET
parameters:
repository: my-fs-repository
snapshot: my-test-snapshot
response:
status: 200
payload:
snapshots:
- snapshot: my-test-snapshot
- synopsis: Get information about a snapshot with human-readable parameter.
path: /_snapshot/{repository}/{snapshot}
method: GET
parameters:
repository: my-fs-repository
snapshot: my-test-snapshot
human: true
response:
status: 200
payload:
snapshots:
- snapshot: my-test-snapshot
Loading