Skip to content

Commit

Permalink
Add test for icu_collation_keyword
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <tsfarr@amazon.com>
  • Loading branch information
Xtansia committed Nov 13, 2024
1 parent ea7d88f commit c80cfaf
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:
tests: plugins/query_insights
- version: 2.18.0
tests: plugins/workload-management
- version: 2.18.0
tests: plugins/analysis-icu
- version: 2.19.0
hub: opensearchstaging
ref: '@sha256:4da23e0137b2b67206d23b36fcf0914cc39b3bf19310c782f536e4934b86f6cc'
Expand Down
8 changes: 7 additions & 1 deletion spec/schemas/_common.mapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ components:
type: object
discriminator:
propertyName: type
x-default: 'object'
x-default: object
oneOf:
- $ref: '#/components/schemas/BinaryProperty'
- $ref: '#/components/schemas/BooleanProperty'
Expand Down Expand Up @@ -1090,6 +1090,12 @@ components:
$ref: '_common.analysis.yaml#/components/schemas/IcuCollationStrength'
variable_top:
type: string
country:
type: string
language:
type: string
variant:
type: string
required:
- type
MatchType:
Expand Down
6 changes: 6 additions & 0 deletions tests/plugins/analysis-icu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ARG OPENSEARCH_DOCKER_HUB_PROJECT
ARG OPENSEARCH_VERSION
ARG OPENSEARCH_DOCKER_REF

FROM ${OPENSEARCH_DOCKER_HUB_PROJECT}/opensearch:${OPENSEARCH_VERSION}${OPENSEARCH_DOCKER_REF}
RUN ./bin/opensearch-plugin install -b analysis-icu
17 changes: 17 additions & 0 deletions tests/plugins/analysis-icu/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
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
$schema: ../../../../../json_schemas/test_story.schema.yaml

description: Test mappings endpoints.
warnings:
multiple-paths-detected: false
prologues: []
epilogues:
- path: /collated
method: DELETE
status: [200, 404]
chapters:
- synopsis: Create an index with a mapping that uses ICU collation.
path: /{index}
method: PUT
parameters:
index: collated
request:
payload:
mappings:
properties:
phrase:
type: icu_collation_keyword
language: tr
strength: primary

- synopsis: Get mappings for index.
path: /{index}/_mapping
method: GET
parameters:
index: collated
response:
status: 200
payload:
collated:
mappings:
properties:
phrase:
type: icu_collation_keyword
language: tr
strength: primary

- synopsis: Index values with ICU collation.
path: /{index}/_bulk
method: POST
parameters:
index: collated
refresh: wait_for
request:
content_type: application/x-ndjson
payload:
- { create: { _id: '1' } }
- { phrase: 'I WİLL USE TURKİSH CASING' }
- { create: { _id: '2' } }
- { phrase: 'ı will use turkish casıng' }

- synopsis: Search for values with ICU collation.
path: /{index}/_search
method: POST
parameters:
index: collated
request:
payload:
query:
term:
phrase: 'I WİLL USE TURKİSH CASING'
sort:
- phrase
- { _id: desc }
response:
status: 200
payload:
hits:
total:
value: 2
hits:
- _id: '2'
_source:
phrase: 'ı will use turkish casıng'
- _id: '1'
_source:
phrase: 'I WİLL USE TURKİSH CASING'

0 comments on commit c80cfaf

Please sign in to comment.