AWS OpenSearch

OpenSearch is an open-source search and analytics tool suite, derived from ElasticSearch, offered as a scalable and flexible solution by Amazon Web Services.

With OpenSearch, you can apply natural language processing, text analyzers, and built in machine learning to quickly return the most relevant data. This makes it a great tool for log analytics, application monitoring, and website searches.

Xano offers a few functions to make OpenSearch requests simple.

Connect to OpenSearch

Requires an OpenSearch Service domain hosted by AWS. Find AWS Documentation on Creating and managing Amazon OpenSearch Service domains.

  1. auth_type Choose between IAM (AWS Identity and Access Management) and master (basic auth from internal user database) to set the type of authentication process to use.

  2. key_id If using IAM, enter the IAM key id you wish to authenticate with. If using master , enter the username you wish to authenticate with.

  3. access_key If using IAM, enter the access key you wish to authenticate with. If using master , enter the password you wish to authenticate with.

  4. region Only required for IAM. Set to the configured OpenSearch region (example: us-east-2).

  5. base_url Set to the domain endpoint (IPv4) specified on AWS.

  6. index Enter the name of the OpenSearch index to send request. Only applicable on Document and Query functions.

AWS OpenSearch Query Wizard Function

Use the query wizard to easily search documents stored in OpenSearch.

Configure

See Connect to OpenSearch for details on configuration.

Then, select a return_type from the options below.

  • search - Returns records that match query

  • count - Returns number of total records matching query

Query

Query Wizard

Set filter criteria using the Xano query builder. The left input is the field to filter on. Then set the operator and value to evaluate. Optionally, add multiple conditions using AND / OR logic.

Select ‘Update Payload’ to ensure your changes are reflected in the query payload.

Output Options

These options can only be set on ‘search’ return type (not ‘count’).

Size: the number of results to return (useful for pagination)

From: the number to offset the results (useful for pagination)

Included Fields: field names to include in the results. Can be formatted as JSON array or comma separated string.

Sort: order to return results. Default is by OpenSearch relevance score. Option to choose one or more fields to sort in ascending or descending order.

Payload (auto-generated)

The JSON sent as the payload to OpenSearch. This is generated by the Query Wizard and Output Options sections. Useful for debugging.

Dynamic values (variables, inputs, etc.) are escaped using parentheses and use Xano expression syntax. These will be evaluated at the time of the request.

Changes made directly to the payload may be overwritten by other areas of the query wizard. If you already have a query payload you want to use, it is recommended to use the OpenSearch Request function instead.

AWS OpenSearch: Document (CRUD) Function

Easily get, add, update, or remove documents from an OpenSearch index.

Configure

See Connect to OpenSearch for details on configuration.

Get Document

  1. Set method of API request to GET

  2. Specify doc_id

Create or Update Document

  1. Set method to POST (create) or PUT (update)

  2. Set doc_id (optional for POST)

  3. Set document payload. Click ‘Use Index Schema’ if you want to import the schema (mapping) directly from the OpenSearch index set under Configure tab. This will use the credentials provided to make a request to OpenSearch on your behalf to get the mapping.

AWS OpenSearch Request

Send any OpenSearch API request using similar configuration methods as outlined in Connect to OpenSearch.

Set the url to use the desired endpoint of the request.

Set query to the JSON payload if necessary.

Last updated