This is a plugin for Architect that provisions managed Amazon OpenSearch for the application.
When you are using Architect's sandbox mode, the plugin downloads and runs Elasticsearch locally.
Pair this pacakge with @nasa-gcn/architect-functions-search to connect to the service from your Node.js Lambda function code.
-
Install this package using npm:
npm i -D @nasa-gcn/architect-plugin-search
-
Add the following to your project's
app.arc
configuration file:@plugins nasa-gcn/architect-plugin-search
-
Amazon offers two flavors of managed OpenSearch: OpenSearch Service and OpenSearch Serverless. By default, this plugin will provision OpenSearch Serverless. If you want to use OpenSearch Service instead, then add a
@search
section to yourapp.arc
file:@search # See https://docs.aws.amazon.com/opensearch-service/latest/developerguide/supported-instance-types.html for supported instance types instanceType t3.small.search instanceCount 2 availabilityZoneCount 2 # dedicatedMasterCount is optional; if zero or undefined, dedicated # master nodes are disabled. dedicatedMasterCount 3 dedicatedMasterType t3.small.search
-
Optionally, create a file called
sandbox-search.json
orsandbox-search.js
in your project and populate it with sample data to be passed toclient.bulk()
. Here are some examples.[ {"index": {"_index": "movies", "_id": 1}}, {"title": "The Hunt for the Red October"}, {"index": {"_index": "movies", "_id": 2}}, {"title": "Star Trek II: The Wrath of Khan"} ]
module.exports = [ {"index": {"_index": "movies", "_id": 1}}, {"title": "The Hunt for the Red October"}, {"index": {"_index": "movies", "_id": 2}}, {"title": "Star Trek II: The Wrath of Khan"} ]
module.exports = function() { return [ {"index": {"_index": "movies", "_id": 1}}, {"title": "The Hunt for the Red October"}, {"index": {"_index": "movies", "_id": 2}}, {"title": "Star Trek II: The Wrath of Khan"} ] }