OpenSearch Overview
TheOPENSEARCH route indexes MQTT messages in OpenSearch for full-text search, real-time analytics, and dashboard visualization. It uses the CLEAN query format for simplified document indexing.
OpenSearch is ideal for log aggregation, metrics visualization, and full-text search across IoT data. Connect it to OpenSearch Dashboards for powerful visualizations.
Basic Syntax
Connection Configuration
OPENSEARCH_CONFIG Parameters
OpenSearch endpoint URL including port (e.g.,
https://opensearch.example.com:9200).OpenSearch username.
OpenSearch password.
CLEAN Query Format
OpenSearch routes use the CLEAN format for document indexing:CLEAN Placeholders
Writing Data
- Basic Indexing
- Log Aggregation
- Time-Series Index
- Self-Signed Certs
Index sensor data for search:
Alternative: STORE IN with Models — Instead of writing EVENT queries, you can bind a model directly to this route. Every See Data Storage Overview for the full STORE IN workflow.
PUBLISH MODEL call automatically inserts a row — no query needed:Reading Data
EVENTs also support search queries to retrieve data from the index. Publish a message to the event’sSOURCE_TOPIC, and the query result is published to DESTINATION_TOPIC. OpenSearch read queries use the CLEAN format with query, sort, and size instead of SQL:
search/result/latest, where your actions or external clients can consume it.
CLEAN Read Operators
Index Mapping Example
Create an index with explicit mappings for better search and aggregation:Troubleshooting
Connection Failed
Connection Failed
- Verify BASE_URL is correct including port
- Check OpenSearch is running and accessible
- Verify firewall allows connections on port 9200
Authentication Failed
Authentication Failed
- Verify USERNAME and PASSWORD are correct
- Check user has permissions to index documents
SSL/Certificate Errors
SSL/Certificate Errors
- Ensure USE_SSL matches the endpoint (http vs https)
- For self-signed certs, set IGNORE_CERT_ERRORS “true”
- Verify certificate chain is complete
Index Errors
Index Errors
- Verify index name is valid (lowercase, no special chars)
- Check field mappings don’t conflict
- Review OpenSearch logs for detailed errors
Next Steps
Data Storage Routes Overview
Compare all storage options.
CrateDB Route
Configure CrateDB for time-series data.

