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

[Bug]: Wrong types for charFilters and tokenFilters in ApiAtlasFtsAnalyzersViewManual #292

Closed
2 tasks done
mcelkys opened this issue Jun 13, 2024 · 3 comments
Closed
2 tasks done

Comments

@mcelkys
Copy link

mcelkys commented Jun 13, 2024

Is there an existing issue for this?

  • I have searched the existing issues

CDK package version

3.6.0

CFN Resource version

N/A

CFN Resource Region

eu-west-2

Current Behavior

ApiAtlasFtsAnalyzersViewManual type contains incorrect definitions for charFilters and tokenFilters.

https://constructs.dev/packages/awscdk-resources-mongodbatlas/v/3.6.0/api/ApiAtlasFtsAnalyzersViewManual?lang=typescript

charFilters: string[];
tokenFilters: string[];

These should be object arrays:

https://www.mongodb.com/docs/atlas/atlas-search/analyzers/character-filters/
https://www.mongodb.com/docs/atlas/atlas-search/analyzers/token-filters/

AWS CDK code to reproduce the issue

new CfnSearchIndex(scope, id, {
  name: name,
  clusterName: clusterName,
  collectionName: collectionName,
  database: database,
  analyzers: [
    {
      name: "custom.english",
      tokenizer: { type: "standard" },
      tokenFilters: [
        { type: "englishPossessive" },
        { type: "lowercase" },
        { type: "porterStemming" },
      ]
    }
  ]
});

Steps To Reproduce

  1. Have a stack that creates a search index with custom analyzers
  2. Run cdk deploy MySearchStack
  3. Deployment fails

cdk synth

Resources:
  roadevAtlasRegistrationSearchIndex:
    Type: MongoDB::Atlas::SearchIndex
    Properties:
      Analyzers:
        - Name: english.companyName
          TokenFilters:
            - type: englishPossessive
            - type: lowercase
            - type: porterStemming
          Tokenizer:
            Type: standard
        - CharFilters:
            - type: mapping
              mappings:
                "'": ""
                Mac: Mc
                mac: mc
          Name: keyword.fullname
          TokenFilters:
            - type: lowercase
          Tokenizer:
            Type: keyword
      ClusterName: roa-lower-cluster
      CollectionName: registrations
      Database: roa-dev
      ProjectId:
        Fn::ImportValue: lowerAtlasProjectId
      Mappings:
        Dynamic: false
        Fields: '{"assignors":{"type":"document","dynamic":false,"fields":{"companyName":[{"type":"string","analyzer":"english.companyName"},{"type":"token","normalizer":"lowercase"}],"companyNumber":{"type":"string","analyzer":"lucene.keyword","searchAnalyzer":"lucene.keyword"},"dateOfBirth":{"type":"document","dynamic":false,"fields":{"month":{"type":"number","representation":"int64"},"year":{"type":"number","representation":"int64"}}},"fullname":[{"type":"string","analyzer":"keyword.fullname"},{"type":"token","normalizer":"lowercase"}]}},"number":{"type":"string","analyzer":"lucene.keyword","searchAnalyzer":"lucene.keyword"},"registrationStatus":{"type":"number","representation":"int64"},"registeredDateTime":{"type":"date"}}'
      Name: roa-registration
      Synonyms:
        - Analyzer: english.companyName
          Name: company-name-synonyms
          Source:
            Collection: synonyms
    Metadata:
      aws:cdk:path: dev-AtlasSearchIndexStack/roa-devAtlasRegistrationSearchIndex
  rspdevAtlasRegistrationSearchIndex:
    Type: MongoDB::Atlas::SearchIndex
    Properties:
      Analyzers:
        - Name: english.companyName
          TokenFilters:
            - type: englishPossessive
            - type: lowercase
            - type: porterStemming
          Tokenizer:
            Type: standard
        - CharFilters:
            - type: mapping
              mappings:
                "'": ""
                Mac: Mc
                mac: mc
          Name: keyword.fullname
          TokenFilters:
            - type: lowercase
          Tokenizer:
            Type: keyword
      ClusterName: rsp-lower-cluster
      CollectionName: registrations
      Database: rsp-dev
      ProjectId:
        Fn::ImportValue: lowerAtlasProjectId
      Mappings:
        Dynamic: false
        Fields: '{"providers":{"type":"document","dynamic":false,"fields":{"companyName":[{"type":"string","analyzer":"english.companyName"},{"type":"token","normalizer":"lowercase"}],"companyNumber":{"type":"string","analyzer":"lucene.keyword","searchAnalyzer":"lucene.keyword"},"dateOfBirth":{"type":"document","dynamic":false,"fields":{"month":{"type":"number","representation":"int64"},"year":{"type":"number","representation":"int64"}}},"fullname":[{"type":"string","analyzer":"keyword.fullname"},{"type":"token","normalizer":"lowercase"}]}},"number":{"type":"string","analyzer":"lucene.keyword","searchAnalyzer":"lucene.keyword"},"registrationStatus":{"type":"number","representation":"int64"},"registeredDateTime":{"type":"date"}}'
      Name: rsp-registration
      Synonyms:
        - Analyzer: english.companyName
          Name: company-name-synonyms
          Source:
            Collection: synonyms
    Metadata:
      aws:cdk:path: dev-AtlasSearchIndexStack/rsp-devAtlasRegistrationSearchIndex
  CDKMetadata:
    Type: AWS::CDK::Metadata
    Properties:
      Analytics: v2:deflate64:H4sIAAAAAAAA/zPSMzQx1TNQTCwv1k1OydbNyUzSqw4uSUzO1nFOywtKLc4vLUpOrdXJy09J1csq1i8ztNAzNANqyCrOzNQtKs0rycxN1QuC0ABjogPWTQAAAA==
    Metadata:
      aws:cdk:path: dev-AtlasSearchIndexStack/CDKMetadata/Default
Parameters:
  BootstrapVersion:
    Type: AWS::SSM::Parameter::Value<String>
    Default: /cdk-bootstrap/hnb659fds/version
    Description: Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]
Rules:
  CheckBootstrapVersion:
    Assertions:
      - Assert:
          Fn::Not:
            - Fn::Contains:
                - - "1"
                  - "2"
                  - "3"
                  - "4"
                  - "5"
                - Ref: BootstrapVersion
        AssertDescription: CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI.

Code of Conduct

  • I agree to follow this project's Code of Conduct
Copy link

Thanks for opening this issue! Please make sure to provide the following information to help us reproduce the issue:

  • CDK code used by the customer
  • The output of cdk synth
  • List of Public CFN Resources that are activated in the AWS account with their release version
  • AWS Region where the CFN stack is running

Thanks for opening this issue. The ticket CLOUDP-254069 was created for internal tracking.

@Zuhairahmed
Copy link
Collaborator

hi @mcelkys we are investigating to reproduce this issue on our end. will revert back with updates, but may take some time to get back to you. appreciate your patience in advance!

@Zuhairahmed
Copy link
Collaborator

Zuhairahmed commented Dec 27, 2024

hi given this ticket has been outstanding for sometime and we unlikely we are able to prioritize anytime soon. resolving this issue as will not complete, but feel free to reach out if there future concerns. including link for internal tracking purposes https://jira.mongodb.org/browse/CLOUDP-254069. thank you for your understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants