Skip to content

Latest commit

 

History

History
95 lines (73 loc) · 3.59 KB

File metadata and controls

95 lines (73 loc) · 3.59 KB

search-index

The official MongoDB Atlas AWS CDK resource for Node.js.

AWS CDK L1 construct and data structures for the AWS CloudFormation Registry type MongoDB::Atlas::SearchIndex v3.0.0.

Description

Returns, adds, edits, and removes Atlas indexes for Search or Vector search. Also returns and updates user-defined analyzers. It requires CFN resource MongoDB::Atlas::SearchIndex >= 3.0.0.

MongoDB Atlas API Docs

For more information about the API refer to: API Endpoints

Usage

In order to use this library, you will need to activate this AWS CloudFormation Registry type in your account. You can do this via the AWS Management Console or using the AWS CLI using the following command:

aws cloudformation activate-type \
  --type-name MongoDB::Atlas::SearchIndex \
  --publisher-id bb989456c78c398a858fef18f2ca1bfc1fbba082 \
  --type RESOURCE \
  --execution-role-arn ROLE-ARN

Alternatively:

aws cloudformation activate-type \
  --public-type-arn arn:aws:cloudformation:us-east-1::type/resource/bb989456c78c398a858fef18f2ca1bfc1fbba082/MongoDB-Atlas-SearchIndex \
  --execution-role-arn ROLE-ARN

You can find more information about activating this type in the AWS CloudFormation documentation.

import { CfnSearchIndex } from 'awscdk-resources-mongodbatlas';

const mySearchIndex = new CfnSearchIndex(this, 'MySearchIndex', {
  profile: atlasProps.profile,
  projectId: atlasProps.projId,
  clusterName: atlasProps.clusterName,
  name: atlasProps.indexNameSearch,
  collectionName: atlasProps.collectionName,
  database: atlasProps.dbName,
  searchAnalyzer: 'lucene.standard',
  analyzer: 'lucene.standard',
  mappings: {
      fields: JSON.stringify({
        employees: {
          type: "string",
          analyzer: "lucene.whitespace",
        }
      }),
      dynamic: false,
  },
});

const myVectorSearchIndex = new CfnSearchIndex(this, 'MyVectorSearchIndex', {
  profile: atlasProps.profile,
  projectId: atlasProps.projId,
  clusterName: atlasProps.clusterName,
  name: atlasProps.indexNameVector,
  collectionName: atlasProps.collectionName,
  database: atlasProps.dbName,
  type: 'vectorSearch',
      fields: JSON.stringify([
        {
          type: "vector",
          path: "plot_embedding",
          numDimensions: 1536,
          similarity: "euclidean"
        }
      ]),
});

Feedback

This library is auto-generated and published to all supported programming languages by the cdklabs/cdk-cloudformation project based on the API schema published for MongoDB::Atlas::SearchIndex.

  • Issues related to this generated library should be reported here.
  • Issues related to MongoDB::Atlas::SearchIndex should be reported to the publisher.
  • Feature requests should be reported here

License

Distributed under the Apache-2.0 License.