For the complete documentation index, see llms.txt. This page is also available as Markdown.

OpenSearch

Extract data from an OpenSearch instance

OpenSearch is the community-driven, Apache-2.0 licensed search and analytics suite (a fork of Elasticsearch). Sling connects to OpenSearch using the official opensearch-go client and extracts documents from one or more indexes.

Sling is read-only for OpenSearch: you can extract data from an OpenSearch instance, but writing to an OpenSearch index as a target is not supported.

Setup

The following credentials keys are accepted:

  • http_url (optional) -> Comma-separated list of HTTP URLs to connect to the cluster

  • host (optional) -> The hostname / ip of the instance

  • port (optional) -> The port of the instance. Default is 9200

  • user (optional) -> The username to access the instance

  • password (optional) -> The password to access the instance

  • tls (optional) -> whether to use TLS for connecting (true/skip-verify/custom)

  • cert_file (optional) -> the client certificate for TLS (file path or raw)

  • cert_key_file (optional) -> the client key for TLS (file path or raw)

  • cert_ca_file (optional) -> the client CA certificate for TLS (file path or raw)

Using sling conns

Here are examples of setting a connection named OPENSEARCH. We must provide the type=opensearch property:

$ sling conns set OPENSEARCH type=opensearch host=<host> user=<user> password=<password> port=9200

Environment Variable

See here to learn more about the .env.sling file.

Sling Env File YAML

See here to learn more about the sling env.yaml file.

Indexes and Tables

Each OpenSearch index is exposed as a stream. The index name is used directly as the stream name:

Columns are derived from the index mapping: text, keyword and string fields become text columns, long and integer fields become bigint, float and double become float, date becomes timestamp, boolean becomes bool, and binary becomes binary. When discovering columns from the index mapping, nested object fields are expanded into dotted column names (for example meta.city). If an index has no mapping, a single data (json) column is returned.

Replication

Here's an example replication configuration to sync OpenSearch indexes to a PostgreSQL database:

Flattening Documents

By default, each document is extracted as a single data JSON column:

Set the flatten source option to expand the document fields into individual columns. Nested objects are flattened using __ as the separator, and arrays are kept as JSON:

Incremental and Backfill

For incremental extraction, set update_key to a date or numeric field in the index. Sling reads documents where that field is greater than the last stored value:

To backfill a specific range of an index, use the range source option together with update_key:

If you are facing issues connecting, give sling assist a try, or reach out to us at support@slingdata.io, on discord or open a Github Issue here.

Last updated

Was this helpful?