Overview
This template provides a production‑ready Apache Solr instance as a Monk runnable. You can:- Run it directly to get a managed enterprise search platform with sensible defaults
- Inherit it in your own runnable to seamlessly add powerful full-text search capabilities to your stack
What this template manages
- Solr container (
solrimage, configurable tag) - Network service on port 8983
- Persistent volumes for data and configuration
- Admin UI and REST API access
- Schema and configuration management
Quick start (run directly)
- Load templates
- Run Solr with defaults
http://localhost:8983/solr/ (or the runnable hostname inside Monk networks).
Configuration
Key variables you can customize in this template:${monk-volume-path}/solr/soldata on the host. Custom Solr configuration is mounted from files/solr.xml.
Use by inheritance (recommended for apps)
Inherit the Solr runnable in your application and declare a connection. Example:Ports and connectivity
- Service:
solron TCP port8983 - From other runnables in the same process group, use
connection-hostname("\<connection-name>")to resolve the Solr host.
Persistence and configuration
- Data path:
${monk-volume-path}/solr/soldata:/var/solr - Config file:
files/solr.xmlmounted to/opt/solr/server/solr/solr.xml - Cores, indexes, and configurations are persisted across restarts
Features
- Full-Text Search: Advanced text analysis and search
- Faceted Search: Drill-down navigation
- Hit Highlighting: Show matched terms in context
- Real-Time Indexing: Near-instant document availability
- Distributed Search: SolrCloud for horizontal scaling
- Rich Document Support: PDF, Word, Excel, HTML, etc.
- Geospatial Search: Location-based queries
- Spell Checking: Did-you-mean suggestions
- Auto-Suggest: Type-ahead completions
- REST API: JSON, XML, CSV responses
Creating a Core
Indexing Documents
JSON API:Searching Documents
Schema Configuration
Define fields and types inschema.xml or use the Schema API:
SolrCloud (Distributed Mode)
For production scalability with multiple Solr nodes:- Deploy a ZooKeeper ensemble
- Configure Solr nodes to connect to ZooKeeper
- Create collections with sharding and replication
Use cases
Solr excels at:- E-commerce product search
- Enterprise document search
- Log and event search
- Geospatial applications
- Content management systems
- Knowledge bases
- Recommendation engines
Related templates
- High‑availability setup: see SolrCloud configuration in the official Solr documentation for distributed deployments.
Troubleshooting
- Access Admin UI at
http://localhost:8983/solr/to check core status and run queries - Use the Analysis page in Admin UI to debug search queries and test analyzers
- Check logs:
- For indexing issues, verify document format matches your schema definition
- For performance issues, consider using a custom
solr.xmlconfiguration with increased JVM heap and cache settings - Ensure the host volume is writable by the container user
- If cores are not loading, verify the
solr.xmlconfiguration and core definitions