Elastic Specifics
Hint
This article is generated by AI translation.
dbVisitor accesses ElasticSearch data sources via the JDBC protocol through the JDBC-Elastic driver. Please note the following when using it:
- Operate data using ElasticSearch DSL commands. Refer to Supported Commands for available commands.
- Supports operating ElasticSearch data sources using JdbcTemplate, Method Annotations, and Mapper File.
- Supports using Rules and Argument Passing for complex command generation and parameter passing.
- Supports using interfaces like ResultSetExtractor, RowMapper to receive query results.
- Supports using Dynamic SQL tags in Mapper Files to generate execution commands.
- Supports Fluent API or Common Mapper.
- Supports Object Mapping, Result Set Mapping.
- Does NOT support executeBatch method of JdbcTemplate.
- Does NOT support Stored Procedure API of JdbcTemplate.
Concept Analogy
In the commands provided by the ElasticSearch driver, different commands have different execution results, mainly three types (Update Count, Single Row Result, Multi-row Result):
- Update Count: Analogous to INSERT, UPDATE, DELETE statements in relational databases, requiring
executeUpdatemethod to execute and get results. - Single Row Result / Multi-row Result: Equivalent to getting query result sets when using SELECT statements in relational databases. In the ElasticSearch driver, all read commands and some commands that cannot return via update count use the result set format.
- When retrieving the result set, the first column is the
_IDfield, and the second column is the_DOCfield. Both fields are in string format.
User Guide
Execute Commands
- Command Style: Use JdbcTemplate to execute raw ElasticSearch commands for reading and writing data.
- Fluent API: Use LambdaTemplate for type-safe ElasticSearch operations.
- BaseMapper: Use BaseMapper interface to simplify ElasticSearch CRUD operations.
- Annotation Style: Use @Insert, @Update, @Delete annotations on Mapper interfaces to customize ElasticSearch CRUD operations.
- File Style: Configure execution commands via tags in Mapper files.