New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@aws-sdk/client-opensearch

Package Overview
Dependencies
Maintainers
5
Versions
360
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/client-opensearch

AWS SDK for JavaScript Opensearch Client for Node.js, Browser and React Native

  • 3.649.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
57K
decreased by-26.78%
Maintainers
5
Weekly downloads
 
Created

What is @aws-sdk/client-opensearch?

@aws-sdk/client-opensearch is an AWS SDK for JavaScript package that allows developers to interact with Amazon OpenSearch Service. It provides a set of APIs to manage and interact with OpenSearch domains, perform search operations, and manage indices and documents.

What are @aws-sdk/client-opensearch's main functionalities?

Create OpenSearch Domain

This feature allows you to create a new OpenSearch domain. The code sample demonstrates how to use the CreateDomainCommand to create a domain with specific configurations.

const { OpenSearchClient, CreateDomainCommand } = require('@aws-sdk/client-opensearch');

const client = new OpenSearchClient({ region: 'us-west-2' });

const createDomain = async () => {
  const params = {
    DomainName: 'my-domain',
    EngineVersion: 'OpenSearch_1.0',
    ClusterConfig: {
      InstanceType: 'm5.large.search',
      InstanceCount: 2
    }
  };
  const command = new CreateDomainCommand(params);
  const response = await client.send(command);
  console.log(response);
};

createDomain();

Index Document

This feature allows you to index a document into an OpenSearch index. The code sample demonstrates how to use the IndexDocumentCommand to add a document to a specified index.

const { OpenSearchClient, IndexDocumentCommand } = require('@aws-sdk/client-opensearch');

const client = new OpenSearchClient({ region: 'us-west-2' });

const indexDocument = async () => {
  const params = {
    DomainName: 'my-domain',
    IndexName: 'my-index',
    DocumentId: '1',
    Document: {
      title: 'Sample Document',
      content: 'This is a sample document.'
    }
  };
  const command = new IndexDocumentCommand(params);
  const response = await client.send(command);
  console.log(response);
};

indexDocument();

Search Documents

This feature allows you to search for documents within an OpenSearch index. The code sample demonstrates how to use the SearchCommand to perform a search query on a specified index.

const { OpenSearchClient, SearchCommand } = require('@aws-sdk/client-opensearch');

const client = new OpenSearchClient({ region: 'us-west-2' });

const searchDocuments = async () => {
  const params = {
    DomainName: 'my-domain',
    IndexName: 'my-index',
    Query: {
      match: {
        content: 'sample'
      }
    }
  };
  const command = new SearchCommand(params);
  const response = await client.send(command);
  console.log(response);
};

searchDocuments();

Other packages similar to @aws-sdk/client-opensearch

FAQs

Package last updated on 10 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc