Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:APIJSON APIJSON Demo DemoSQLExecutor ES

From Leeroopedia
Knowledge Sources
Domains Database, Elasticsearch, SQL_Execution
Last Updated 2026-10-14 00:00 GMT

Overview

Concrete tool for executing SQL against Elasticsearch data sources via Druid ES adapter, intercepting POST/PUT/DELETE to route to Elasticsearch-native operations.

Description

The DemoSQLExecutor class (Elasticsearch variant) extends APIJSONSQLExecutor<Object> and overrides executeUpdate to detect Elasticsearch datasource targets. When the database is Elasticsearch, it delegates to ESOptions for insert/updateBySql/deleteBySql operations instead of JDBC. For standard JDBC datasources, it falls back to super.executeUpdate.

Usage

Use this class when the APIJSON Elasticsearch demo needs to execute write operations against Elasticsearch indices.

Code Reference

Source Location

Signature

@Log4j2
public class DemoSQLExecutor extends APIJSONSQLExecutor<Object> {
    @Override
    public Connection getConnection(SQLConfig config) throws Exception;
    @Override
    public int executeUpdate(@NotNull SQLConfig config, String sql) throws Exception;
}

Import

import apijson.demo.DemoSQLExecutor;

I/O Contract

Inputs

Name Type Required Description
config SQLConfig Yes SQL configuration with datasource info
sql String Yes Generated SQL statement

Outputs

Name Type Description
executeUpdate() returns int Number of affected rows

Usage Examples

ES Insert via APIJSON

// POST to ES datasource
{
  "ES_blog": {
    "title": "Hello ES",
    "content": "Content via APIJSON"
  }
}
// DemoSQLExecutor detects ES datasource and routes to ESOptions.insert()

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment