1.0.8 • Published 2 years ago

@ndlib/aws-opensearch v1.0.8

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

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
      }
    },
    ...
  ]
}
ParameterDescriptionRequired
opensearch_hostnameThe OpenSearch host name associated with the endpoint for the search domain being used.yes
opensearch_passwordThe password required that allows write operations against the domainyes
opensearch_portThe port number used by the OpenSearch apiyes
opensearch_protocolThere are only two options: http or httpsyes
index_nameThe name of the OpenSearch index.yes
content_groupingTwo options: either 'bulk' or 'individual' referring to the number of documents being indexed.yes
queryThe GraphQL query used to build the data set to be indexedyes
unique_idThe GraphQL query used to build the data set to be indexedyes
selectorA function to remap the query data to the top level.yes
mappingsA function to create custom mappings for OpenSearch.yes
1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago