Introduction
jdbc-elastic is an independent JDBC driver. Access Elasticsearch with REST-style commands for document reads and writes, searches and index management. Use Connection, PreparedStatement and ResultSet directly; dbVisitor APIs are optional.
Features
- Bind request parameters with PreparedStatement and read search results through ResultSet.
- Read and write documents, manage indexes, search, count and run
_catqueries. - Expand document fields into result columns and configure pre-read thresholds and cache storage.
Metadata Queries
Query through connection.getMetaData():
| JDBC method | Result |
|---|---|
getCatalogs() | Empty result; no separate catalog namespace |
getTables() | Indices |
getColumns() | Fields declared in mappings |
getSchemas() | Empty result |
getTableTypes() | TABLE |
Get Connected
- Add dependencies: Maven or Gradle configuration.
- Connect to the database: JDBC URL, credentials and connection examples.
- Configure parameters: names, defaults and units.
- Usage limitations: JDBC support and database-specific restrictions.
Before You Connect
- Commands must use the syntax supported by this driver; arbitrary relational SQL is not translated.
- JDBC batch and transactions are not supported. Check the shared JDBC limitations before integrating a connection pool, ORM or other JDBC tool.
When using dbVisitor APIs, Elastic6 and Elastic7 dialects are available.