The Things-Search service maintains an optimized search index of all Things and executes search queries against it.
TL;DR: The Things-Search service listens for Thing and Policy change events, updates a search-optimized MongoDB collection, and processes RQL search queries to find matching Things.
Overview
The Things-Search service has two main responsibilities:
- Index maintenance: Track changes to Things, Features, and Policies by consuming events from the Things and Policies services, and keep a search-optimized index up to date.
- Query execution: Accept search queries and return matching Thing IDs from the index.
How it works
Model
The Things-Search service does not define its own entity model. It uses the models from the Things and Policies services.
It does include a parser that transforms RQL search queries into a Java domain model:
Signals
Other services communicate with the Things-Search service via:
- Commands: Search commands and their responses
Persistence
The Things-Search service maintains its own MongoDB collections optimized for full-text and attribute-based search:
| Collection | Purpose |
|---|---|
search |
The search index containing Thing data in a search-optimized format |
searchSync |
A single-document capped collection that records the instant until which Thing events are indexed |