OpenSearch Overview
TheOPENSEARCH connector indexes MQTT messages as documents in OpenSearch and publishes search results back to MQTT. Each event either indexes one document or runs one search, and models can store into an index with STORE IN. The connector talks to the OpenSearch REST API over HTTP or HTTPS, with basic authentication.
OpenSearch suits logs, events, and sensor data you want to search and chart. Connect OpenSearch Dashboards to the same indices for visualizations.
Quick Start
- Index messages
- Search on request
Index each reading as a new document:Publishing
{"value": 21.5} to sensors/s1/reading indexes one document into readings.Connection Configuration
OPENSEARCH_CONFIG Parameters
Server root with scheme and port, for example
https://opensearch.example.com:9200. A path is kept, so a reverse-proxy prefix such as https://gateway.example.com/opensearch works. A host without a scheme uses https://.Optional Settings
Optional Settings
User for basic authentication. It must not contain
:. Leave out USERNAME and PASSWORD for a cluster without security.Password for
USERNAME. Use GET SECRET. Any character works, including ; = ' @ : / and non-ASCII characters.true accepts any server certificate, such as a self-signed one or one for another host name. Use it only in a test setup. Default: false, which checks the certificate against the CAs trusted by the broker host.Seconds one request may take, from sending it to the end of the answer. A request that takes longer fails. From 1 to 3600. Default:
30.Settings checked at deploy
A connector whose settings cannot work is refused when you deploy it. The message names the setting and never repeats the password. These are refused:- A
BASE_URLthat is not anhttp://orhttps://URL, or that has a query (?…) or a fragment (#…) - A login inside
BASE_URL, such ashttps://user:password@opensearch.example.com:9200. Put it inUSERNAMEandPASSWORD. USE_SSL falsewith anhttps://BASE_URL, orUSE_SSL truewithhttp://- A
USERNAMEthat contains:, or aPASSWORDwithout aUSERNAME - A boolean that is not
trueorfalse, or a timeout that is not a whole number from 1 to 3600
USERNAME with an empty PASSWORD, for example a GET SECRET that is not set yet, still deploys. Requests then fail with an authentication error.
Credentials
The login is sent as basic authentication (Authorization: Basic, UTF-8) on every request. It never appears in the log, in a connection check reply, or in a status message.
API keys, AWS IAM (SigV4) signing, and client certificates are not supported. On Amazon OpenSearch Service, use an internal user of fine-grained access control.
Least privilege. The connector needs no cluster permissions. For events and
STORE IN, a role with these index permissions on its own indices is enough:
Event Configuration
EVENT Parameters
An index request or a search, as a CLEAN or JSON object. See Query format.
Query format
QUERY is a JSON object, written as CLEAN:{key: value} with unquoted keys and simple values, or as plain JSON with its quotes escaped for the LoT string ("{\"index\": \"readings\", …}").
A query with both index and body indexes a document. Any other query is a search.
Index options
Search options
Every key exceptindex is sent as the _search request body, so any search option that OpenSearch accepts works.
Only the hits are published. Aggregations (
aggs) run, but their results are not published. A search with no match publishes [].
Index names
An event’sindex is lowercased, and \ / ? " < > |, spaces, and hyphens become _. So coreflux-events is written to and searched in coreflux_events. Use underscores in event index names.
STORE IN only lowercases its WITH TABLE name and keeps hyphens.
Placeholders
Each placeholder goes in as one JSON value, so a payload cannot change the structure of the query, and values are stored as sent:
- Unquoted (
value: {payload.json.value}): a JSON number,true,false, ornullkeeps its type. A JSON object or array goes in as that JSON. Any other text is stored as a string, with its quotes, apostrophes, commas, braces, and backslashes. Text such as{topic}inside a value is not expanded. - Quoted (
text: \"{payload}\"): always one JSON string, whatever the payload holds. Quote free text that goes into a search, so a payload is searched for as text.
2026-01-02T03:04:05.678+02:00 keeps its offset in the document and in search results.
Writing Data
- Whole Payload
- One Document per Machine
- Self-Signed Certificate
Index each JSON payload with its line and the time it arrived:Each index request publishes a result to
DESTINATION_TOPIC:Alternative: STORE IN with Models. Instead of writing an index query, bind a model to this connector. Each model update indexes one new document with the model’s fields into the index named by
WITH TABLE, plus a UTC timestamp unless the model has a timestamp field. OpenSearch creates the index on first use:STORE IN keeps the hyphen, so this writes to line-readings. See Data Storage Overview for the full STORE IN workflow.When a field changes type
OpenSearch builds the index mapping from the first document. If a field later changes type, for example a number becomes text, OpenSearch refuses the documents that do not fit. Each refusal is logged with OpenSearch’s reason, such asmapper_parsing_exception: failed to parse field [count] of type [long]. Use a new index, or reindex.
Reading Data
A search event reads documents on demand. Publish to itsSOURCE_TOPIC, and the matching documents are published to DESTINATION_TOPIC as one JSON array:
_source of each hit:
Plain JSON queries
Write the query as JSON, with its quotes escaped for the LoT string:Paging and sorting
Take the range and the page from the payload:Timed Polling
AnEVERY event runs the same search on a schedule:
Query patterns
When an event fails
A request that OpenSearch refuses, such as a bad query, a mapping conflict,403, or 429, or a request that cannot reach OpenSearch, fails the event. Nothing is published, the error is logged, and the event’s ON ERROR block runs. The error carries OpenSearch’s own type and reason, for example:
STORE IN document is logged the same way. Requests are not retried.
While OpenSearch is unreachable
A request that cannot reach OpenSearch (refused, unreachable, a TLS failure, or no answer within the timeout) marks the connector disconnected. An answer that is an error, such as400, 403, or 429, leaves it connected, because the server answered.
After a connection failure, the next event or STORE IN checks OpenSearch at once. If OpenSearch answers, the work runs. If not, the work is skipped and later checks run at most every 5 seconds. Work that arrives between checks is skipped instead of each request waiting out a timeout.
Each check logs how many events and STORE IN documents were skipped: a warning while OpenSearch is still down, and an information line with the total when the connector reconnects.
A removed or redeployed connector closes its connections.
Checking the connection
-checkConnectorConnection <Name> sends GET / with the connector’s own settings and login. The check passes when OpenSearch answers, and also on 403: the login was accepted, and the user only lacks cluster permissions, which the connector does not need. The reply names the endpoint (scheme, host, port, and path), never the login. The check waits at most 8 seconds.
CONNECTION_TIMEOUT while connecting, REQUEST_TIMEOUT once connected.
Troubleshooting
Deploy refused
Deploy refused
- Put the scheme and port in
BASE_URL, with no login, query, or fragment - Move a login from
BASE_URLtoUSERNAMEandPASSWORD - Remove
USE_SSL, or make it match the scheme ofBASE_URL
Authentication failed
Authentication failed
- Check
USERNAMEandPASSWORD - A
GET SECRETthat is not set leavesPASSWORDempty, which fails the same way
TLS handshake failed
TLS handshake failed
- Install the cluster’s CA on the broker host
- For a self-signed certificate in a test setup, set
IGNORE_CERT_ERRORS "true" - “Closed the connection” usually means
http://against an HTTPS port, or the reverse. Fix the scheme inBASE_URL.
Connection refused or no answer
Connection refused or no answer
- Check that OpenSearch is running and listening on that host and port. Managed services often use port 443.
- Check that a firewall allows the connection
- Raise
CONNECTION_TIMEOUTfor a slow link
403 Forbidden on an event
403 Forbidden on an event
- Grant the user the index permission it needs on that index pattern. See Credentials.
- Name the
indexin every search
A search event writes documents
A search event writes documents
- The query has both
indexandbody. Move the search options out ofbody, next toindex.
Documents land in my_index instead of my-index
Documents land in my_index instead of my-index
- Event index names turn hyphens into
_. Use underscores, orSTORE IN, which keeps hyphens.
Next Steps
Data Storage Connectors Overview
Compare all storage options.
CrateDB Connector
Configure CrateDB for time-series data.

