Commands
Hint
This article is generated by AI translation.
jdbc-elastic parses SQL-style commands and converts them into underlying REST requests. Supported command patterns are below.
Search Operations
| Command | Description | Example |
|---|---|---|
GET .../_search | Execute search query | GET /my_index/_search { "query": { "match_all": {} } } |
POST .../_search | Execute search query | POST /my_index/_search { "query": { "term": { "user": "kimchy" } } } |
GET .../_count | Count documents | GET /my_index/_count |
GET .../_msearch | Multi search | GET /_msearch |
GET .../_mget | Multi get | GET /_mget |
GET .../_explain | Get explanation | GET /my_index/_explain/1 |
GET .../_source | Get document source | GET /my_index/_source/1 |
Document Operations
| Command | Description | Example |
|---|---|---|
PUT .../_doc/... | Create or update document | PUT /my_index/_doc/1 { "user": "kimchy" } |
POST .../_doc/... | Create document | POST /my_index/_doc/ { "user": "kimchy" } |
POST .../_create/... | Create document (fail if exists) | POST /my_index/_create/1 { "user": "kimchy" } |
POST .../_update/... | Update document | POST /my_index/_update/1 { "doc": { "age": 20 } } |
POST .../_update_by_query | Update by query | POST /my_index/_update_by_query { "script": ... } |
DELETE ... | Delete document | DELETE /my_index/_doc/1 |
POST .../_delete_by_query | Delete by query | POST /my_index/_delete_by_query { "query": ... } |
Index Management
| Command | Description | Example |
|---|---|---|
PUT /index | Create index | PUT /new_index |
DELETE /index | Delete index | DELETE /new_index |
POST .../_open | Open index | POST /my_index/_open |
POST .../_close | Close index | POST /my_index/_close |
PUT .../_mapping | Set Mapping | PUT /my_index/_mapping { "properties": ... } |
PUT .../_settings | Set Settings | PUT /my_index/_settings { "index": ... } |
POST /_aliases | Alias management | POST /_aliases { "actions": ... } |
POST /_reindex | Reindex | POST /_reindex { "source": ..., "dest": ... } |
POST .../_refresh | Refresh index | POST /my_index/_refresh |
Cluster Info
| Command | Description | Example |
|---|---|---|
GET /_cat/... | Get cluster info | GET /_cat/nodes?v |
GET /_cluster/... | Get cluster state | GET /_cluster/health |
General Requests
jdbc-elastic supports any GET, POST, PUT, DELETE, HEAD requests. As long as it conforms to the ElasticSearch REST API specification, it can be executed via the JDBC interface.
Hint Support
jdbc-elastic supports overriding or enhancing query behavior via SQL Hint. The Hint format is /*+ hint_name=value */ and must be placed at the beginning of the SQL statement.
| Hint Name | Description | Example |
|---|---|---|
overwrite_find_limit | Overrides the size parameter of the query, used for pagination or limiting the number of returned records. | /*+ overwrite_find_limit=10 */ POST /idx/_search |
overwrite_find_skip | Overrides the from parameter of the query, used for pagination to skip a specified number of records. | /*+ overwrite_find_skip=20 */ POST /idx/_search |
overwrite_find_as_count | Converts the query to a Count operation, ignoring the returned document content and returning only the match count. | /*+ overwrite_find_as_count */ POST /idx/_search |