AWS OpenSearch
In this example we create a new OpenSearch domain, link it to a function, and then query it.
Start by creating a new OpenSearch domain.
const search = new sst.aws.OpenSearch("MySearch");Once linked to a function, we can connect to it.
import { Resource } from "sst";import { Client } from "@opensearch-project/opensearch";
const client = new Client({ node: Resource.MySearch.url, auth: { username: Resource.MySearch.username, password: Resource.MySearch.password }});This is using the OpenSearch JS SDK to connect to the OpenSearch domain..
const search = new sst.aws.OpenSearch("MySearch");const app = new sst.aws.Function("MyApp", { handler: "index.handler", url: true, link: [search],});View the full example.