diff --git a/.github/workflows/test-spec.yml b/.github/workflows/test-spec.yml index 1207af83..7286b887 100644 --- a/.github/workflows/test-spec.yml +++ b/.github/workflows/test-spec.yml @@ -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' diff --git a/spec/schemas/_common.mapping.yaml b/spec/schemas/_common.mapping.yaml index 563aa2f2..12087d9e 100644 --- a/spec/schemas/_common.mapping.yaml +++ b/spec/schemas/_common.mapping.yaml @@ -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' @@ -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: diff --git a/tests/plugins/analysis-icu/Dockerfile b/tests/plugins/analysis-icu/Dockerfile new file mode 100644 index 00000000..aa43b705 --- /dev/null +++ b/tests/plugins/analysis-icu/Dockerfile @@ -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 diff --git a/tests/plugins/analysis-icu/docker-compose.yml b/tests/plugins/analysis-icu/docker-compose.yml new file mode 100644 index 00000000..0f4c7da5 --- /dev/null +++ b/tests/plugins/analysis-icu/docker-compose.yml @@ -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 diff --git a/tests/plugins/analysis-icu/indices/mapping/icu_collation_keyword.yaml b/tests/plugins/analysis-icu/indices/mapping/icu_collation_keyword.yaml new file mode 100644 index 00000000..29e4b5e9 --- /dev/null +++ b/tests/plugins/analysis-icu/indices/mapping/icu_collation_keyword.yaml @@ -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'