# @ndlib/aws-opensearch

> Library for interacting with AWS OpenSearch

Latest version **1.0.8** (published 2022-09-14) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @ndlib/aws-opensearch
pnpm add @ndlib/aws-opensearch
yarn add @ndlib/aws-opensearch
bun add @ndlib/aws-opensearch
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2022-09-14 |
| First published | 2022-08-11 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12.9.0 <15 \|\| >=16.0.0 |
| Dependencies | 2 |
| Unpacked size | 67.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Hesburgh Libraries, University of Notre Dame |
| Maintainers | jrittenh, thanstra, robertjonfox, danthewolfe, stevemattison |
| Keywords | aws, opensearch |

## Links

- npm: https://www.npmjs.com/package/@ndlib/aws-opensearch
- Repository: https://github.com/ndlib/aws-opensearch
- Homepage: https://github.com/ndlib/aws-opensearch#readme
- Issues: https://github.com/ndlib/aws-opensearch/issues
- npm.io page: https://npm.io/package/@ndlib/aws-opensearch

## Dependencies (2)

- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [cacheable-lookup](https://npm.io/package/cacheable-lookup.md) ^6.1.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.8 (latest) — 2022-09-14
- 1.0.7 — 2022-08-17
- 1.0.6 — 2022-08-16
- 1.0.5 — 2022-08-12
- 1.0.4 — 2022-08-11
- 1.0.3 — 2022-08-11
- 1.0.2 — 2022-08-11
- 1.0.1 — 2022-08-11
- 1.0.0 — 2022-08-11

## README

# AWS OpenSearch

This is a plugin designed to facilitate any interaction with AWS OpenSearch. In order to use this plugin, several assumptions are made. Those are listed below.

* First, OpenSearch requires either IAM signed operations, which requires a lot of setup and the use of authentication keys, or it requires the use of Basic HTTP Authentication. We use the latter.
* Given the previous assumption, you will need to provide in the context for your consuming application the username and password required to interact with OpenSearch
* We also assume that all request and response bodies transferred using REST interactions are serialized using JSON - if you attempt interaction with OpenSearch using another data format it will not work
* The JSON body passed to OpenSearch should be just that - JSON, not a string. The response body will be JSON. JSON in, and JSON out.
* The plugin provides basic error checking - whether the connection was successful, whether a response was received from the OpenSearch API and what that response was. However, it makes no assumptions about what "success" looks like when indexing a document. The consuming application is responsible for determining whether the operation was truly a success.
* All interactions with OpenSearch happen over HTTPS

## Configuration Parameters Needed

* You will need the host name of your OpenSearch domain
* You will need the Basic Auth credentials
* You will need the name of the index you will use within your search domain

## Example of use

How to use (in `gatsby-config.js`):

```
import { opensearch_mappings } from './content/opensearch/mappings'
import { opensearch_query } from './content/opensearch/query'
import { opensearch_selector } from './content/opensearch/selector'

...

module.exports = {
  plugins: [
    ...
    {
      resolve: '@ndlib/aws-opensearch',
      options: {
        opensearch_hostname: <hostname>,
        opensearch_password: <password>,
        opensearch_port: <port-number>,
        opensearch_protocol: <http | https>
        index_name: <index_name>,
        content_grouping: 'bulk' | 'individual',
        query: opensearch_query,
        unique_id: <unique_id_field>,
        selector: opensearch_selector,
        mappings: opensearch_mappings
      }
    },
    ...
  ]
}
```

| Parameter | Description | Required |
| ------------- |:-------------| ----- |
| opensearch_hostname | The OpenSearch host name associated with the endpoint for the search domain being used. | yes |
| opensearch_password | The password required that allows write operations against the domain | yes |
| opensearch_port | The port number used by the OpenSearch api | yes |
| opensearch_protocol | There are only two options: http or https | yes |
| index_name | The name of the OpenSearch index. | yes |
| content_grouping | Two options: either 'bulk' or 'individual' referring to the number of documents being indexed. | yes |
| query | The GraphQL query used to build the data set to be indexed | yes |
| unique_id | The GraphQL query used to build the data set to be indexed | yes |
| selector | A function to remap the query data to the top level. | yes |
| mappings | A function to create custom mappings for OpenSearch. | yes |

---
_Source: https://npm.io/package/@ndlib/aws-opensearch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
