瀏覽代碼

Merge branch '2.x'

spuerx 9 年之前
父節點
當前提交
b59f86d800
共有 31 個文件被更改,包括 3400 次插入13 次删除
  1. 1 1
      create_index.sh
  2. 1 3
      src/main/java/org/elasticsearch/util/ElasticMockClient.java
  3. 1 1
      src/main/java/org/elasticsearch/dsl/bean/ElasticSqlParseResult.java
  4. 139 0
      src/main/java/org/elasticsearch/jdbc/AbstractConnection.java
  5. 68 0
      src/main/java/org/elasticsearch/jdbc/AbstractDataSource.java
  6. 77 0
      src/main/java/org/elasticsearch/jdbc/AbstractDriverBasedDataSource.java
  7. 150 0
      src/main/java/org/elasticsearch/jdbc/AbstractFeatureNotSupportedConnection.java
  8. 975 0
      src/main/java/org/elasticsearch/jdbc/AbstractFeatureNotSupportedResultSet.java
  9. 99 0
      src/main/java/org/elasticsearch/jdbc/AbstractFeatureNotSupportedStatement.java
  10. 98 0
      src/main/java/org/elasticsearch/jdbc/AbstractResultSet.java
  11. 124 0
      src/main/java/org/elasticsearch/jdbc/AbstractStatement.java
  12. 7 0
      src/main/java/org/elasticsearch/jdbc/ConnectionProxy.java
  13. 84 0
      src/main/java/org/elasticsearch/jdbc/DriverManagerDataSource.java
  14. 39 0
      src/main/java/org/elasticsearch/jdbc/ElasticConnection.java
  15. 892 0
      src/main/java/org/elasticsearch/jdbc/ElasticDatabaseMetaData.java
  16. 64 0
      src/main/java/org/elasticsearch/jdbc/ElasticDriver.java
  17. 60 0
      src/main/java/org/elasticsearch/jdbc/ElasticResultSet.java
  18. 132 0
      src/main/java/org/elasticsearch/jdbc/ElasticResultSetMetaData.java
  19. 195 0
      src/main/java/org/elasticsearch/jdbc/ElasticSingleConnectionDataSource.java
  20. 48 0
      src/main/java/org/elasticsearch/jdbc/ElasticStatement.java
  21. 4 0
      src/main/java/org/elasticsearch/jdbc/SearchActionExecutor.java
  22. 10 0
      src/main/java/org/elasticsearch/jdbc/SmartDataSource.java
  23. 63 0
      src/main/java/org/elasticsearch/jdbc/TransportClientFactory.java
  24. 61 0
      src/test/java/org/elasticsearch/jdbc/ElasticDriverTest.java
  25. 1 1
      src/test/java/org/elasticsearch/SqlParserLimitTest.java
  26. 1 1
      src/test/java/org/elasticsearch/SqlParserListenerTest.java
  27. 1 1
      src/test/java/org/elasticsearch/SqlParserOrderByTest.java
  28. 1 1
      src/test/java/org/elasticsearch/SqlParserQueryTest.java
  29. 1 1
      src/test/java/org/elasticsearch/SqlParserRoutingTest.java
  30. 1 1
      src/test/java/org/elasticsearch/SqlParserSelectFieldTest.java
  31. 2 2
      src/test/java/org/elasticsearch/SqlParserWhereConditionTest.java

+ 1 - 1
create_index.sh

@@ -5,7 +5,7 @@ curl -XPUT 'http://192.168.0.109:9200/index/' -d '{
 	"settings": {
 		"index": {
 			"number_of_shards": 1,
-			"number_of_replicas": 3
+			"number_of_replicas": 0
 		}
 	},
 	"mappings": {

+ 1 - 3
src/main/java/org/elasticsearch/util/ElasticMockClient.java

@@ -1,4 +1,4 @@
-package org.elasticsearch.util;
+package org.elasticsearch.client;
 
 import org.elasticsearch.action.*;
 import org.elasticsearch.action.bulk.BulkRequest;
@@ -41,8 +41,6 @@ import org.elasticsearch.action.termvectors.*;
 import org.elasticsearch.action.update.UpdateRequest;
 import org.elasticsearch.action.update.UpdateRequestBuilder;
 import org.elasticsearch.action.update.UpdateResponse;
-import org.elasticsearch.client.AdminClient;
-import org.elasticsearch.client.Client;
 import org.elasticsearch.client.support.Headers;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.threadpool.ThreadPool;

+ 1 - 1
src/main/java/org/elasticsearch/dsl/bean/ElasticSqlParseResult.java

@@ -10,7 +10,7 @@ import org.elasticsearch.index.query.QueryBuilders;
 import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
 import org.elasticsearch.search.aggregations.AggregationBuilder;
 import org.elasticsearch.search.sort.SortBuilder;
-import org.elasticsearch.util.ElasticMockClient;
+import org.elasticsearch.client.ElasticMockClient;
 
 import java.util.List;
 

+ 139 - 0
src/main/java/org/elasticsearch/jdbc/AbstractConnection.java

@@ -0,0 +1,139 @@
+package org.elasticsearch.jdbc;
+
+import java.sql.*;
+import java.util.Properties;
+
+public abstract class AbstractConnection extends AbstractFeatureNotSupportedConnection {
+    private boolean closed = false;
+    private int transactionIsolation;
+
+    protected String url;
+    protected Properties info;
+
+    public AbstractConnection(String url, Properties info) {
+        this.url = url;
+        this.info = info;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public final <T> T unwrap(final Class<T> iface) throws SQLException {
+        if (isWrapperFor(iface)) {
+            return (T) this;
+        }
+        throw new SQLException(String.format("[%s] cannot be unwrapped as [%s]", getClass().getName(), iface.getName()));
+    }
+
+    @Override
+    public final boolean isWrapperFor(final Class<?> iface) throws SQLException {
+        return iface.isInstance(this);
+    }
+
+    @Override
+    public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
+        return createStatement();
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
+        return prepareStatement(sql);
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
+        return prepareStatement(sql);
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
+        return prepareStatement(sql);
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
+        return prepareStatement(sql);
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
+        return prepareStatement(sql);
+    }
+
+    @Override
+    public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
+        return createStatement();
+    }
+
+
+    @Override
+    public boolean getAutoCommit() throws SQLException {
+        return true;
+    }
+
+
+    @Override
+    public void setTransactionIsolation(int level) throws SQLException {
+        this.transactionIsolation = level;
+    }
+
+    @Override
+    public int getTransactionIsolation() throws SQLException {
+        return transactionIsolation;
+    }
+
+    @Override
+    public boolean isReadOnly() throws SQLException {
+        return true;
+    }
+
+    @Override
+    public void close() throws SQLException {
+        closed = true;
+    }
+
+    @Override
+    public boolean isClosed() throws SQLException {
+        return closed;
+    }
+
+    @Override
+    public void setReadOnly(boolean readOnly) throws SQLException {
+        // ignore
+    }
+
+    @Override
+    public void commit() throws SQLException {
+        // ignore
+    }
+
+    @Override
+    public void rollback() throws SQLException {
+        // ignore
+    }
+
+    @Override
+    public void setAutoCommit(boolean autoCommit) throws SQLException {
+        // ignore
+    }
+
+    @Override
+    public SQLWarning getWarnings() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public void clearWarnings() throws SQLException {
+        // ignore
+    }
+
+    @Override
+    public final int getHoldability() throws SQLException {
+        return ResultSet.HOLD_CURSORS_OVER_COMMIT;
+    }
+
+    @Override
+    public final void setHoldability(final int holdability) throws SQLException {
+        // ignore
+    }
+
+}

+ 68 - 0
src/main/java/org/elasticsearch/jdbc/AbstractDataSource.java

@@ -0,0 +1,68 @@
+package org.elasticsearch.jdbc;
+
+
+import javax.sql.DataSource;
+import java.io.PrintWriter;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.logging.Logger;
+
+
+public abstract class AbstractDataSource implements DataSource {
+
+    /**
+     * Returns 0, indicating the default system timeout is to be used.
+     */
+    public int getLoginTimeout() throws SQLException {
+        return 0;
+    }
+
+    /**
+     * Setting a login timeout is not supported.
+     */
+    public void setLoginTimeout(int timeout) throws SQLException {
+        throw new SQLFeatureNotSupportedException("setLoginTimeout");
+    }
+
+    /**
+     * LogWriter methods are not supported.
+     */
+    public PrintWriter getLogWriter() {
+        throw new UnsupportedOperationException("getLogWriter");
+    }
+
+    /**
+     * LogWriter methods are not supported.
+     */
+    public void setLogWriter(PrintWriter pw) throws SQLException {
+        throw new SQLFeatureNotSupportedException("setLogWriter");
+    }
+
+
+    //---------------------------------------------------------------------
+    // Implementation of JDBC 4.0's Wrapper interface
+    //---------------------------------------------------------------------
+
+    @SuppressWarnings("unchecked")
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        if (iface.isInstance(this)) {
+            return (T) this;
+        }
+        throw new SQLException("DataSource of type [" + getClass().getName() +
+                "] cannot be unwrapped as [" + iface.getName() + "]");
+    }
+
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        return iface.isInstance(this);
+    }
+
+
+    //---------------------------------------------------------------------
+    // Implementation of JDBC 4.1's getParentLogger method
+    //---------------------------------------------------------------------
+
+    public Logger getParentLogger() {
+        return Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
+    }
+
+}

+ 77 - 0
src/main/java/org/elasticsearch/jdbc/AbstractDriverBasedDataSource.java

@@ -0,0 +1,77 @@
+package org.elasticsearch.jdbc;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Properties;
+
+public abstract class AbstractDriverBasedDataSource extends AbstractDataSource {
+
+    private String url;
+
+    private String username;
+
+    private String password;
+
+    private Properties connectionProperties;
+
+    public void setUrl(String url) {
+        this.url = url.trim();
+    }
+
+    public String getUrl() {
+        return this.url;
+    }
+
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+
+    public String getUsername() {
+        return this.username;
+    }
+
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getPassword() {
+        return this.password;
+    }
+
+
+    public void setConnectionProperties(Properties connectionProperties) {
+        this.connectionProperties = connectionProperties;
+    }
+
+    public Properties getConnectionProperties() {
+        return this.connectionProperties;
+    }
+
+    public Connection getConnection() throws SQLException {
+        return getConnectionFromDriver(getUsername(), getPassword());
+    }
+
+    public Connection getConnection(String username, String password) throws SQLException {
+        return getConnectionFromDriver(username, password);
+    }
+
+    protected Connection getConnectionFromDriver(String username, String password) throws SQLException {
+        Properties mergedProps = new Properties();
+        Properties connProps = getConnectionProperties();
+        if (connProps != null) {
+            mergedProps.putAll(connProps);
+        }
+        if (username != null) {
+            mergedProps.setProperty("user", username);
+        }
+        if (password != null) {
+            mergedProps.setProperty("password", password);
+        }
+        return getConnectionFromDriver(mergedProps);
+    }
+
+    protected abstract Connection getConnectionFromDriver(Properties props) throws SQLException;
+}

+ 150 - 0
src/main/java/org/elasticsearch/jdbc/AbstractFeatureNotSupportedConnection.java

@@ -0,0 +1,150 @@
+package org.elasticsearch.jdbc;
+
+
+import java.sql.*;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.Executor;
+
+public abstract class AbstractFeatureNotSupportedConnection implements Connection {
+
+    @Override
+    public final CallableStatement prepareCall(final String sql) throws SQLException {
+        throw new SQLFeatureNotSupportedException("prepareCall");
+    }
+
+    @Override
+    public final CallableStatement prepareCall(final String sql, final int resultSetType, final int resultSetConcurrency) throws SQLException {
+        throw new SQLFeatureNotSupportedException("prepareCall");
+    }
+
+    @Override
+    public final CallableStatement prepareCall(final String sql, final int resultSetType, final int resultSetConcurrency, final int resultSetHoldability) throws SQLException {
+        throw new SQLFeatureNotSupportedException("prepareCall");
+    }
+
+    @Override
+    public final String nativeSQL(final String sql) throws SQLException {
+        throw new SQLFeatureNotSupportedException("nativeSQL");
+    }
+
+    @Override
+    public final Savepoint setSavepoint() throws SQLException {
+        throw new SQLFeatureNotSupportedException("setSavepoint");
+    }
+
+    @Override
+    public final Savepoint setSavepoint(final String name) throws SQLException {
+        throw new SQLFeatureNotSupportedException("setSavepoint name");
+    }
+
+    @Override
+    public final void releaseSavepoint(final Savepoint savepoint) throws SQLException {
+        throw new SQLFeatureNotSupportedException("releaseSavepoint");
+    }
+
+    @Override
+    public final void rollback(final Savepoint savepoint) throws SQLException {
+        throw new SQLFeatureNotSupportedException("rollback savepoint");
+    }
+
+    @Override
+    public final void abort(final Executor executor) throws SQLException {
+        throw new SQLFeatureNotSupportedException("abort");
+    }
+
+    @Override
+    public final String getCatalog() throws SQLException {
+        throw new SQLFeatureNotSupportedException("getCatalog");
+    }
+
+    @Override
+    public final void setCatalog(final String catalog) throws SQLException {
+        throw new SQLFeatureNotSupportedException("setCatalog");
+    }
+
+    @Override
+    public final String getSchema() throws SQLException {
+        throw new SQLFeatureNotSupportedException("getSchema");
+    }
+
+    @Override
+    public final void setSchema(final String schema) throws SQLException {
+        throw new SQLFeatureNotSupportedException("setSchema");
+    }
+
+    @Override
+    public final Map<String, Class<?>> getTypeMap() throws SQLException {
+        throw new SQLFeatureNotSupportedException("getTypeMap");
+    }
+
+    @Override
+    public final void setTypeMap(final Map<String, Class<?>> map) throws SQLException {
+        throw new SQLFeatureNotSupportedException("setTypeMap");
+    }
+
+    @Override
+    public final int getNetworkTimeout() throws SQLException {
+        throw new SQLFeatureNotSupportedException("getNetworkTimeout");
+    }
+
+    @Override
+    public final void setNetworkTimeout(final Executor executor, final int milliseconds) throws SQLException {
+        throw new SQLFeatureNotSupportedException("setNetworkTimeout");
+    }
+
+    @Override
+    public final Clob createClob() throws SQLException {
+        throw new SQLFeatureNotSupportedException("createClob");
+    }
+
+    @Override
+    public final Blob createBlob() throws SQLException {
+        throw new SQLFeatureNotSupportedException("createBlob");
+    }
+
+    @Override
+    public final NClob createNClob() throws SQLException {
+        throw new SQLFeatureNotSupportedException("createNClob");
+    }
+
+    @Override
+    public final SQLXML createSQLXML() throws SQLException {
+        throw new SQLFeatureNotSupportedException("createSQLXML");
+    }
+
+    @Override
+    public final Array createArrayOf(final String typeName, final Object[] elements) throws SQLException {
+        throw new SQLFeatureNotSupportedException("createArrayOf");
+    }
+
+    @Override
+    public final Struct createStruct(final String typeName, final Object[] attributes) throws SQLException {
+        throw new SQLFeatureNotSupportedException("createStruct");
+    }
+
+    @Override
+    public final boolean isValid(final int timeout) throws SQLException {
+        throw new SQLFeatureNotSupportedException("isValid");
+    }
+
+    @Override
+    public final Properties getClientInfo() throws SQLException {
+        throw new SQLFeatureNotSupportedException("getClientInfo");
+    }
+
+    @Override
+    public final String getClientInfo(final String name) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getClientInfo name");
+    }
+
+    @Override
+    public final void setClientInfo(final String name, final String value) throws SQLClientInfoException {
+        throw new UnsupportedOperationException("setClientInfo name value");
+    }
+
+    @Override
+    public final void setClientInfo(final Properties properties) throws SQLClientInfoException {
+        throw new UnsupportedOperationException("setClientInfo properties");
+    }
+}

+ 975 - 0
src/main/java/org/elasticsearch/jdbc/AbstractFeatureNotSupportedResultSet.java

@@ -0,0 +1,975 @@
+package org.elasticsearch.jdbc;
+
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.*;
+import java.util.Calendar;
+import java.util.Map;
+
+public abstract class AbstractFeatureNotSupportedResultSet implements ResultSet {
+    @Override
+    public void cancelRowUpdates() throws SQLException {
+        throw new SQLFeatureNotSupportedException("cancelRowUpdates");
+    }
+
+    @Override
+    public void deleteRow() throws SQLException {
+        throw new SQLFeatureNotSupportedException("deleteRow");
+    }
+
+    @Override
+    public void insertRow() throws SQLException {
+        throw new SQLFeatureNotSupportedException("insertRow");
+    }
+
+    @Override
+    public void moveToCurrentRow() throws SQLException {
+        throw new SQLFeatureNotSupportedException("moveToCurrentRow");
+    }
+
+    @Override
+    public void moveToInsertRow() throws SQLException {
+        throw new SQLFeatureNotSupportedException("moveToInsertRow");
+    }
+
+    @Override
+    public void refreshRow() throws SQLException {
+        throw new SQLFeatureNotSupportedException("refreshRow");
+    }
+
+    @Override
+    public void updateRow() throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateRow");
+    }
+
+
+    @Override
+    public boolean first() throws SQLException {
+        throw new SQLFeatureNotSupportedException("first");
+    }
+
+    @Override
+    public boolean isAfterLast() throws SQLException {
+        throw new SQLFeatureNotSupportedException("isAfterLast");
+    }
+
+    @Override
+    public boolean isBeforeFirst() throws SQLException {
+        throw new SQLFeatureNotSupportedException("isBeforeFirst");
+    }
+
+    @Override
+    public boolean isFirst() throws SQLException {
+        throw new SQLFeatureNotSupportedException("isFirst");
+    }
+
+
+    @Override
+    public boolean isLast() throws SQLException {
+        throw new SQLFeatureNotSupportedException("isLast");
+    }
+
+    @Override
+    public boolean last() throws SQLException {
+        throw new SQLFeatureNotSupportedException("last");
+    }
+
+    @Override
+    public boolean previous() throws SQLException {
+        throw new SQLFeatureNotSupportedException("previous");
+    }
+
+    @Override
+    public boolean rowDeleted() throws SQLException {
+        throw new SQLFeatureNotSupportedException("rowDeleted");
+    }
+
+    @Override
+    public boolean rowInserted() throws SQLException {
+        throw new SQLFeatureNotSupportedException("rowInserted");
+    }
+
+    @Override
+    public boolean rowUpdated() throws SQLException {
+        throw new SQLFeatureNotSupportedException("rowUpdated");
+    }
+
+    @Override
+    public void setFetchDirection(int direction) throws SQLException {
+        throw new SQLFeatureNotSupportedException("setFetchDirection");
+    }
+
+    @Override
+    public void setFetchSize(int rows) throws SQLException {
+        throw new SQLFeatureNotSupportedException("setFetchSize");
+    }
+
+    @Override
+    public boolean absolute(int row) throws SQLException {
+        throw new SQLFeatureNotSupportedException("absolute");
+    }
+
+
+    @Override
+    public boolean relative(int offset) throws SQLException {
+        throw new SQLFeatureNotSupportedException("relative");
+    }
+
+    @Override
+    public String getCursorName() throws SQLException {
+        throw new SQLFeatureNotSupportedException("getCursorName");
+    }
+
+    @Override
+    public void updateArray(int columnIndex, Array x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateArray");
+    }
+
+    @Override
+    public void updateArray(String columnLabel, Array x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateArray");
+    }
+
+
+    @Override
+    public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateAsciiStream");
+    }
+
+
+    @Override
+    public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateAsciiStream");
+    }
+
+
+    @Override
+    public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateAsciiStream");
+    }
+
+
+    @Override
+    public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateAsciiStream");
+    }
+
+
+    @Override
+    public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateAsciiStream");
+    }
+
+
+    @Override
+    public void updateAsciiStream(String columnLabel, InputStream x, long length)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateAsciiStream");
+    }
+
+
+    @Override
+    public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBigDecimal");
+    }
+
+
+    @Override
+    public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBigDecimal");
+    }
+
+
+    @Override
+    public void updateBinaryStream(int columnIndex, InputStream x)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBinaryStream");
+    }
+
+
+    @Override
+    public void updateBinaryStream(String columnLabel, InputStream x)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBinaryStream");
+    }
+
+
+    @Override
+    public void updateBinaryStream(int columnIndex, InputStream x, int length)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBinaryStream");
+    }
+
+
+    @Override
+    public void updateBinaryStream(String columnLabel, InputStream x, int length)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBinaryStream");
+    }
+
+
+    @Override
+    public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBinaryStream");
+    }
+
+
+    @Override
+    public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBinaryStream");
+    }
+
+
+    @Override
+    public void updateBlob(int columnIndex, Blob x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBlob");
+    }
+
+
+    @Override
+    public void updateBlob(String columnLabel, Blob x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBlob");
+    }
+
+
+    @Override
+    public void updateBlob(int columnIndex, InputStream x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBlob");
+    }
+
+
+    @Override
+    public void updateBlob(String columnLabel, InputStream x)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBlob");
+    }
+
+
+    @Override
+    public void updateBlob(int columnIndex, InputStream x, long length)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBlob");
+    }
+
+
+    @Override
+    public void updateBlob(String columnLabel, InputStream x, long length)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBlob");
+    }
+
+
+    @Override
+    public void updateBoolean(int columnIndex, boolean x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBoolean");
+    }
+
+
+    @Override
+    public void updateBoolean(String columnLabel, boolean x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBoolean");
+    }
+
+
+    @Override
+    public void updateByte(int columnIndex, byte x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBytes");
+    }
+
+
+    @Override
+    public void updateByte(String columnLabel, byte x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBytes");
+    }
+
+
+    @Override
+    public void updateBytes(int columnIndex, byte[] x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBytes");
+    }
+
+
+    @Override
+    public void updateBytes(String columnLabel, byte[] x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateBytes");
+    }
+
+
+    @Override
+    public void updateCharacterStream(int columnIndex, Reader x)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateCharacterStream");
+    }
+
+
+    @Override
+    public void updateCharacterStream(String columnLabel, Reader x)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateCharacterStream");
+    }
+
+
+    @Override
+    public void updateCharacterStream(int columnIndex, Reader x, int length)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateCharacterStream");
+    }
+
+
+    @Override
+    public void updateCharacterStream(String columnLabel, Reader x, int length)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateCharacterStream");
+    }
+
+
+    @Override
+    public void updateCharacterStream(int columnIndex, Reader x, long length)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateCharacterStream");
+    }
+
+
+    @Override
+    public void updateCharacterStream(String columnLabel, Reader x, long length)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateCharacterStream");
+    }
+
+
+    @Override
+    public void updateClob(int columnIndex, Clob x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateClob");
+    }
+
+
+    @Override
+    public void updateClob(String columnLabel, Clob x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateClob");
+    }
+
+
+    @Override
+    public void updateClob(int columnIndex, Reader x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateClob");
+    }
+
+
+    @Override
+    public void updateClob(String columnLabel, Reader x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateClob");
+    }
+
+
+    @Override
+    public void updateClob(int columnIndex, Reader x, long length) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateClob");
+    }
+
+
+    @Override
+    public void updateClob(String columnLabel, Reader x, long length) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateClob");
+    }
+
+
+    @Override
+    public void updateDate(int columnIndex, Date x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateDate");
+    }
+
+
+    @Override
+    public void updateDate(String columnLabel, Date x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateDate");
+    }
+
+
+    @Override
+    public void updateDouble(int columnIndex, double x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateDouble");
+    }
+
+
+    @Override
+    public void updateDouble(String columnLabel, double x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateDouble");
+    }
+
+
+    @Override
+    public void updateFloat(int columnIndex, float x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateFloat");
+    }
+
+
+    @Override
+    public void updateFloat(String columnLabel, float x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateFloat");
+    }
+
+
+    @Override
+    public void updateInt(int columnIndex, int x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateInt");
+    }
+
+
+    @Override
+    public void updateInt(String columnLabel, int x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateInt");
+    }
+
+
+    @Override
+    public void updateLong(int columnIndex, long x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateLong");
+    }
+
+
+    @Override
+    public void updateLong(String columnLabel, long x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateLong");
+    }
+
+
+    @Override
+    public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateNCharacterStream");
+    }
+
+
+    @Override
+    public void updateNCharacterStream(String columnLabel, Reader x)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateNCharacterStream");
+    }
+
+
+    @Override
+    public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateNCharacterStream");
+    }
+
+
+    @Override
+    public void updateNCharacterStream(String columnLabel, Reader x, long length) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateNCharacterStream");
+    }
+
+
+    @Override
+    public void updateNClob(int columnIndex, NClob x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateNClob");
+    }
+
+
+    @Override
+    public void updateNClob(String columnLabel, NClob x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateNClob");
+    }
+
+
+    @Override
+    public void updateNClob(int columnIndex, Reader x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateNClob");
+    }
+
+
+    @Override
+    public void updateNClob(String columnLabel, Reader x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateNClob");
+    }
+
+
+    @Override
+    public void updateNClob(int columnIndex, Reader x, long length)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateNClob");
+    }
+
+
+    @Override
+    public void updateNClob(String columnLabel, Reader x, long length)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateNClob");
+    }
+
+
+    @Override
+    public void updateNString(int columnIndex, String x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateNString");
+    }
+
+
+    @Override
+    public void updateNString(String columnLabel, String x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateNString");
+    }
+
+
+    @Override
+    public void updateNull(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateNull");
+    }
+
+
+    @Override
+    public void updateNull(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateNull");
+    }
+
+
+    @Override
+    public void updateObject(int columnIndex, Object x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateObject");
+    }
+
+
+    @Override
+    public void updateObject(String columnLabel, Object x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateObject");
+    }
+
+
+    @Override
+    public void updateObject(int columnIndex, Object x, int scale) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateObject");
+    }
+
+
+    @Override
+    public void updateObject(String columnLabel, Object x, int scale) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateObject");
+    }
+
+
+    @Override
+    public void updateRef(int columnIndex, Ref x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateRef");
+    }
+
+
+    @Override
+    public void updateRef(String columnLabel, Ref x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateRef");
+    }
+
+
+    @Override
+    public void updateRowId(int columnIndex, RowId x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateRowId");
+    }
+
+
+    @Override
+    public void updateRowId(String columnLabel, RowId x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateRowId");
+    }
+
+
+    @Override
+    public void updateShort(int columnIndex, short x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateShort");
+    }
+
+
+    @Override
+    public void updateShort(String columnLabel, short x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateShort");
+    }
+
+
+    @Override
+    public void updateSQLXML(int columnIndex, SQLXML x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateSQLXML");
+    }
+
+
+    @Override
+    public void updateSQLXML(String columnLabel, SQLXML x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateSQLXML");
+    }
+
+
+    @Override
+    public void updateString(int columnIndex, String x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateString");
+    }
+
+
+    @Override
+    public void updateString(String columnLabel, String x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateString");
+    }
+
+
+    @Override
+    public void updateTime(int columnIndex, Time x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateTime");
+    }
+
+
+    @Override
+    public void updateTime(String columnLabel, Time x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateTime");
+    }
+
+
+    @Override
+    public void updateTimestamp(int columnIndex, Timestamp x)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateTimestamp");
+    }
+
+
+    @Override
+    public void updateTimestamp(String columnLabel, Timestamp x)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("updateTimestamp");
+    }
+
+
+    @Override
+    public Timestamp getTimestamp(int columnIndex, Calendar cal)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("getTimestamp");
+    }
+
+
+    @Override
+    public Timestamp getTimestamp(String columnLabel, Calendar cal)
+            throws SQLException {
+        throw new SQLFeatureNotSupportedException("getTimestamp");
+    }
+
+    @Override
+    public InputStream getUnicodeStream(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getUnicodeStream");
+    }
+
+
+    @Override
+    public InputStream getUnicodeStream(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getUnicodeStream");
+    }
+
+
+    @Override
+    public URL getURL(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getURL");
+    }
+
+
+    @Override
+    public URL getURL(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getURL");
+    }
+
+    @Override
+    public Time getTime(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getTime");
+    }
+
+    @Override
+    public Time getTime(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getTime");
+    }
+
+
+    @Override
+    public Time getTime(int columnIndex, Calendar cal) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getTime");
+    }
+
+
+    @Override
+    public Time getTime(String columnLabel, Calendar cal) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getTime");
+    }
+
+    @Override
+    public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getObject");
+    }
+
+    @Override
+    public Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getObject");
+    }
+
+
+    @Override
+    public Ref getRef(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getRef");
+    }
+
+    @Override
+    public Ref getRef(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getRef");
+    }
+
+    @Override
+    public RowId getRowId(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getRowId");
+    }
+
+
+    @Override
+    public RowId getRowId(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getRowId");
+    }
+
+
+    @Override
+    public short getShort(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getShort");
+    }
+
+    @Override
+    public short getShort(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getShort");
+    }
+
+
+    @Override
+    public SQLXML getSQLXML(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getSQLXML");
+    }
+
+    @Override
+    public SQLXML getSQLXML(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getSQLXML");
+    }
+
+    @Override
+    public Clob getClob(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getClob");
+    }
+
+
+    @Override
+    public Clob getClob(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getClob");
+    }
+
+
+    @Override
+    public Date getDate(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getDate");
+    }
+
+
+    @Override
+    public Date getDate(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getDate");
+    }
+
+    @Override
+    public Date getDate(int columnIndex, Calendar cal) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getDate");
+    }
+
+    @Override
+    public Date getDate(String columnLabel, Calendar cal) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getDate");
+    }
+
+    @Override
+    public double getDouble(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getDouble");
+    }
+
+    @Override
+    public double getDouble(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getDouble");
+    }
+
+    @Override
+    public float getFloat(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getFloat");
+    }
+
+    @Override
+    public float getFloat(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getFloat");
+    }
+
+    @Override
+    public int getInt(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getInt");
+    }
+
+    @Override
+    public int getInt(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getInt");
+    }
+
+    @Override
+    public long getLong(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getLong");
+    }
+
+    @Override
+    public long getLong(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getLong");
+    }
+
+
+    @Override
+    public Reader getNCharacterStream(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getNCharacterStream");
+    }
+
+    @Override
+    public Reader getNCharacterStream(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getNCharacterStream");
+    }
+
+    @Override
+    public NClob getNClob(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getNClob");
+    }
+
+
+    @Override
+    public NClob getNClob(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getNClob");
+    }
+
+    @Override
+    public Array getArray(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getArray");
+    }
+
+    @Override
+    public Array getArray(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getArray");
+    }
+
+    @Override
+    public InputStream getAsciiStream(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getAsciiStream");
+    }
+
+    @Override
+    public InputStream getAsciiStream(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getAsciiStream");
+    }
+
+
+    @Override
+    public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getBigDecimal");
+    }
+
+
+    @Override
+    public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getBigDecimal");
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getBigDecimal");
+    }
+
+    @Override
+    public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getBigDecimal");
+    }
+
+    @Override
+    public InputStream getBinaryStream(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getBinaryStream");
+    }
+
+    @Override
+    public InputStream getBinaryStream(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getBinaryStream");
+    }
+
+    @Override
+    public Blob getBlob(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getBlob");
+    }
+
+    @Override
+    public Blob getBlob(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getBlob");
+    }
+
+
+    @Override
+    public boolean getBoolean(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getBoolean");
+    }
+
+    @Override
+    public boolean getBoolean(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getBoolean");
+    }
+
+    @Override
+    public byte getByte(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getByte");
+    }
+
+    @Override
+    public byte[] getBytes(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getBytes");
+    }
+
+    @Override
+    public Timestamp getTimestamp(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getTimestamp");
+    }
+
+    @Override
+    public byte getByte(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getByte");
+    }
+
+    @Override
+    public byte[] getBytes(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getBytes");
+    }
+
+    @Override
+    public Timestamp getTimestamp(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getTimestamp");
+    }
+
+    @Override
+    public Reader getCharacterStream(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getCharacterStream");
+    }
+
+    @Override
+    public Reader getCharacterStream(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getCharacterStream");
+    }
+
+    @Override
+    public String getNString(int columnIndex) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getNString");
+    }
+
+    @Override
+    public String getNString(String columnLabel) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getNString");
+    }
+
+    @Override
+    public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getObject");
+    }
+
+    @Override
+    public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
+        throw new SQLFeatureNotSupportedException("getObject");
+    }
+}

+ 99 - 0
src/main/java/org/elasticsearch/jdbc/AbstractFeatureNotSupportedStatement.java

@@ -0,0 +1,99 @@
+package org.elasticsearch.jdbc;
+
+
+import java.sql.*;
+
+public abstract class AbstractFeatureNotSupportedStatement implements Statement {
+
+    @Override
+    public final int getFetchDirection() throws SQLException {
+        throw new SQLFeatureNotSupportedException("getFetchDirection");
+    }
+
+    @Override
+    public final void setFetchDirection(final int direction) throws SQLException {
+        throw new SQLFeatureNotSupportedException("setFetchDirection");
+    }
+
+    @Override
+    public final void addBatch(final String sql) throws SQLException {
+        throw new SQLFeatureNotSupportedException("addBatch sql");
+    }
+
+    @Override
+    public void clearBatch() throws SQLException {
+        throw new SQLFeatureNotSupportedException("clearBatch");
+    }
+
+    @Override
+    public int[] executeBatch() throws SQLException {
+        throw new SQLFeatureNotSupportedException("executeBatch");
+    }
+
+    @Override
+    public final void closeOnCompletion() throws SQLException {
+        throw new SQLFeatureNotSupportedException("closeOnCompletion");
+    }
+
+    @Override
+    public final boolean isCloseOnCompletion() throws SQLException {
+        throw new SQLFeatureNotSupportedException("isCloseOnCompletion");
+    }
+
+    @Override
+    public final int executeUpdate(String sql) throws SQLException {
+        throw new SQLFeatureNotSupportedException("executeUpdate");
+    }
+
+    @Override
+    public void setCursorName(String name) throws SQLException {
+        throw new SQLFeatureNotSupportedException("setCursorName");
+    }
+
+    @Override
+    public int getUpdateCount() throws SQLException {
+        throw new SQLFeatureNotSupportedException("getUpdateCount");
+    }
+
+    @Override
+    public boolean getMoreResults() throws SQLException {
+        throw new SQLFeatureNotSupportedException("getMoreResults");
+    }
+
+    @Override
+    public ResultSet getGeneratedKeys() throws SQLException {
+        throw new SQLFeatureNotSupportedException("getGeneratedKeys");
+    }
+
+    @Override
+    public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
+        throw new SQLFeatureNotSupportedException("executeUpdate");
+    }
+
+    @Override
+    public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
+        throw new SQLFeatureNotSupportedException("executeUpdate");
+    }
+
+
+    @Override
+    public int executeUpdate(String sql, String[] columnNames) throws SQLException {
+        throw new SQLFeatureNotSupportedException("executeUpdate");
+    }
+
+    @Override
+    public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
+        throw new SQLFeatureNotSupportedException("execute");
+    }
+
+    @Override
+    public boolean execute(String sql, int[] columnIndexes) throws SQLException {
+        throw new SQLFeatureNotSupportedException("execute");
+    }
+
+    @Override
+    public boolean execute(String sql, String[] columnNames) throws SQLException {
+        throw new SQLFeatureNotSupportedException("execute");
+    }
+
+}

+ 98 - 0
src/main/java/org/elasticsearch/jdbc/AbstractResultSet.java

@@ -0,0 +1,98 @@
+package org.elasticsearch.jdbc;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Statement;
+
+public abstract class AbstractResultSet extends AbstractFeatureNotSupportedResultSet {
+
+    protected boolean isClosed = false;
+
+    protected Statement statement;
+
+    public AbstractResultSet(Statement statement) {
+        this.statement = statement;
+    }
+
+    @Override
+    public void close() throws SQLException {
+        isClosed = true;
+    }
+
+    @Override
+    public boolean isClosed() throws SQLException {
+        return isClosed;
+    }
+
+    @Override
+    public int findColumn(String columnLabel) throws SQLException {
+        //aways return first col
+        return 1;
+    }
+
+    @Override
+    public boolean wasNull() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public SQLWarning getWarnings() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public void clearWarnings() throws SQLException {
+        // ignore
+    }
+
+    @Override
+    public int getFetchDirection() throws SQLException {
+        return ResultSet.FETCH_FORWARD;
+    }
+
+    @Override
+    public int getType() throws SQLException {
+        return ResultSet.TYPE_FORWARD_ONLY;
+    }
+
+    @Override
+    public int getConcurrency() throws SQLException {
+        return ResultSet.CONCUR_READ_ONLY;
+    }
+
+    @Override
+    public Statement getStatement() throws SQLException {
+        return statement;
+    }
+
+    @Override
+    public int getHoldability() throws SQLException {
+        return ResultSet.CLOSE_CURSORS_AT_COMMIT;
+    }
+
+    @Override
+    public Object getObject(int columnIndex) throws SQLException {
+        return getString(columnIndex);
+    }
+
+    @Override
+    public Object getObject(String columnLabel) throws SQLException {
+        return getString(columnLabel);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public final <T> T unwrap(final Class<T> iface) throws SQLException {
+        if (isWrapperFor(iface)) {
+            return (T) this;
+        }
+        throw new SQLException(String.format("[%s] cannot be unwrapped as [%s]", getClass().getName(), iface.getName()));
+    }
+
+    @Override
+    public final boolean isWrapperFor(final Class<?> iface) throws SQLException {
+        return iface.isInstance(this);
+    }
+
+}

+ 124 - 0
src/main/java/org/elasticsearch/jdbc/AbstractStatement.java

@@ -0,0 +1,124 @@
+package org.elasticsearch.jdbc;
+
+import java.sql.*;
+
+public abstract class AbstractStatement extends AbstractFeatureNotSupportedStatement {
+
+    private boolean isClosed = false;
+
+    @Override
+    public void close() throws SQLException {
+        isClosed = true;
+    }
+
+    @Override
+    public int getMaxFieldSize() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public void setMaxFieldSize(int max) throws SQLException {
+        // ignore
+    }
+
+    @Override
+    public int getMaxRows() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public void setMaxRows(int max) throws SQLException {
+        // ignore
+    }
+
+    @Override
+    public void setEscapeProcessing(boolean enable) throws SQLException {
+        // ignore
+    }
+
+    @Override
+    public int getQueryTimeout() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public void setQueryTimeout(int seconds) throws SQLException {
+        // ignore
+    }
+
+    @Override
+    public void cancel() throws SQLException {
+        // ignore
+    }
+
+    @Override
+    public SQLWarning getWarnings() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public void clearWarnings() throws SQLException {
+
+    }
+
+    @Override
+    public void setFetchSize(int rows) throws SQLException {
+        // ignore
+    }
+
+    @Override
+    public int getFetchSize() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getResultSetConcurrency() throws SQLException {
+        return ResultSet.CONCUR_READ_ONLY;
+    }
+
+    @Override
+    public int getResultSetType() throws SQLException {
+        return ResultSet.TYPE_FORWARD_ONLY;
+    }
+
+    @Override
+    public boolean getMoreResults(int current) throws SQLException {
+        return false;
+    }
+
+
+    @Override
+    public int getResultSetHoldability() throws SQLException {
+        return ResultSet.CLOSE_CURSORS_AT_COMMIT;
+    }
+
+    @Override
+    public boolean isClosed() throws SQLException {
+        return isClosed;
+    }
+
+
+    @Override
+    public void setPoolable(boolean poolable) throws SQLException {
+        // ignore
+    }
+
+    @Override
+    public boolean isPoolable() throws SQLException {
+        return false;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public final <T> T unwrap(final Class<T> iface) throws SQLException {
+        if (isWrapperFor(iface)) {
+            return (T) this;
+        }
+        throw new SQLException(String.format("[%s] cannot be unwrapped as [%s]", getClass().getName(), iface.getName()));
+    }
+
+    @Override
+    public final boolean isWrapperFor(final Class<?> iface) throws SQLException {
+        return iface.isInstance(this);
+    }
+}

+ 7 - 0
src/main/java/org/elasticsearch/jdbc/ConnectionProxy.java

@@ -0,0 +1,7 @@
+package org.elasticsearch.jdbc;
+
+import java.sql.Connection;
+
+public interface ConnectionProxy extends Connection {
+    Connection getTargetConnection();
+}

+ 84 - 0
src/main/java/org/elasticsearch/jdbc/DriverManagerDataSource.java

@@ -0,0 +1,84 @@
+package org.elasticsearch.jdbc;
+
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Properties;
+
+public class DriverManagerDataSource extends AbstractDriverBasedDataSource {
+    public DriverManagerDataSource() {
+    }
+
+
+    public DriverManagerDataSource(String url) {
+        setUrl(url);
+    }
+
+
+    public DriverManagerDataSource(String url, String username, String password) {
+        setUrl(url);
+        setUsername(username);
+        setPassword(password);
+    }
+
+    public DriverManagerDataSource(String url, Properties conProps) {
+        setUrl(url);
+        setConnectionProperties(conProps);
+    }
+
+    @Deprecated
+    public DriverManagerDataSource(String driverClassName, String url, String username, String password) {
+        setDriverClassName(driverClassName);
+        setUrl(url);
+        setUsername(username);
+        setPassword(password);
+    }
+
+
+    public void setDriverClassName(String driverClassName) {
+        String driverClassNameToUse = driverClassName.trim();
+        try {
+            Class.forName(driverClassNameToUse, true, getDefaultClassLoader());
+        }
+        catch (ClassNotFoundException ex) {
+            throw new IllegalStateException("Could not load JDBC driver class [" + driverClassNameToUse + "]", ex);
+        }
+    }
+
+
+    public static ClassLoader getDefaultClassLoader() {
+        ClassLoader cl = null;
+        try {
+            cl = Thread.currentThread().getContextClassLoader();
+        }
+        catch (Throwable ex) {
+            // Cannot access thread context ClassLoader - falling back...
+        }
+        if (cl == null) {
+            // No thread context class loader -> use class loader of this class.
+            cl = DriverManagerDataSource.class.getClassLoader();
+            if (cl == null) {
+                // getClassLoader() returning null indicates the bootstrap ClassLoader
+                try {
+                    cl = ClassLoader.getSystemClassLoader();
+                }
+                catch (Throwable ex) {
+                    // Cannot access system ClassLoader - oh well, maybe the caller can live with null...
+                }
+            }
+        }
+        return cl;
+    }
+
+    @Override
+    protected Connection getConnectionFromDriver(Properties props) throws SQLException {
+        String url = getUrl();
+        return getConnectionFromDriverManager(url, props);
+    }
+
+    protected Connection getConnectionFromDriverManager(String url, Properties props) throws SQLException {
+        return DriverManager.getConnection(url, props);
+    }
+
+}

+ 39 - 0
src/main/java/org/elasticsearch/jdbc/ElasticConnection.java

@@ -0,0 +1,39 @@
+package org.elasticsearch.jdbc;
+
+import org.elasticsearch.client.Client;
+
+import java.sql.DatabaseMetaData;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+
+public class ElasticConnection extends AbstractConnection {
+
+    private Client client;
+
+    public ElasticConnection(String url, Properties info, Client client) {
+        super(url, info);
+        this.client = client;
+    }
+
+    Client getClient() {
+        return client;
+    }
+
+    @Override
+    public Statement createStatement() throws SQLException {
+        return new ElasticStatement(this);
+    }
+
+    @Override
+    public PreparedStatement prepareStatement(String sql) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public DatabaseMetaData getMetaData() throws SQLException {
+        return new ElasticDatabaseMetaData(url);
+    }
+
+}

+ 892 - 0
src/main/java/org/elasticsearch/jdbc/ElasticDatabaseMetaData.java

@@ -0,0 +1,892 @@
+package org.elasticsearch.jdbc;
+
+import java.sql.*;
+
+public class ElasticDatabaseMetaData implements DatabaseMetaData {
+
+    private String url;
+
+    public ElasticDatabaseMetaData(String url) {
+        this.url = url;
+    }
+
+    @Override
+    public boolean allProceduresAreCallable() throws SQLException {
+        return true;
+    }
+
+    @Override
+    public boolean allTablesAreSelectable() throws SQLException {
+        return true;
+    }
+
+    @Override
+    public String getURL() throws SQLException {
+        return url;
+    }
+
+    @Override
+    public String getUserName() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public boolean isReadOnly() throws SQLException {
+        return true;
+    }
+
+    @Override
+    public boolean nullsAreSortedHigh() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean nullsAreSortedLow() throws SQLException {
+        return true;
+    }
+
+    @Override
+    public boolean nullsAreSortedAtStart() throws SQLException {
+        return nullsAreSortedHigh();
+    }
+
+    @Override
+    public boolean nullsAreSortedAtEnd() throws SQLException {
+        return nullsAreSortedLow();
+    }
+
+    @Override
+    public String getDatabaseProductName() throws SQLException {
+        return "elasticsearch_2.4.4";
+    }
+
+    @Override
+    public String getDatabaseProductVersion() throws SQLException {
+        return "2.4.5";
+    }
+
+    @Override
+    public String getDriverName() throws SQLException {
+        return "org.elasticsearch.jdbc.ElasticDriver";
+    }
+
+    @Override
+    public String getDriverVersion() throws SQLException {
+        return "1.0";
+    }
+
+    @Override
+    public int getDriverMajorVersion() {
+        return 1;
+    }
+
+    @Override
+    public int getDriverMinorVersion() {
+        return 0;
+    }
+
+    @Override
+    public boolean usesLocalFiles() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean usesLocalFilePerTable() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsMixedCaseIdentifiers() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean storesUpperCaseIdentifiers() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean storesLowerCaseIdentifiers() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean storesMixedCaseIdentifiers() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public String getIdentifierQuoteString() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public String getSQLKeywords() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public String getNumericFunctions() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public String getStringFunctions() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public String getSystemFunctions() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public String getTimeDateFunctions() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public String getSearchStringEscape() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public String getExtraNameCharacters() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public boolean supportsAlterTableWithAddColumn() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsAlterTableWithDropColumn() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsColumnAliasing() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean nullPlusNonNullIsNull() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsConvert() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsConvert(int fromType, int toType) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsTableCorrelationNames() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsDifferentTableCorrelationNames() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsExpressionsInOrderBy() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsOrderByUnrelated() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsGroupBy() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsGroupByUnrelated() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsGroupByBeyondSelect() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsLikeEscapeClause() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsMultipleResultSets() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsMultipleTransactions() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsNonNullableColumns() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsMinimumSQLGrammar() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsCoreSQLGrammar() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsExtendedSQLGrammar() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsANSI92EntryLevelSQL() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsANSI92IntermediateSQL() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsANSI92FullSQL() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsIntegrityEnhancementFacility() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsOuterJoins() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsFullOuterJoins() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsLimitedOuterJoins() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public String getSchemaTerm() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public String getProcedureTerm() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public String getCatalogTerm() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public boolean isCatalogAtStart() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public String getCatalogSeparator() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public boolean supportsSchemasInDataManipulation() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsSchemasInProcedureCalls() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsSchemasInTableDefinitions() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsSchemasInIndexDefinitions() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsCatalogsInDataManipulation() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsCatalogsInProcedureCalls() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsCatalogsInTableDefinitions() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsPositionedDelete() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsPositionedUpdate() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsSelectForUpdate() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsStoredProcedures() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsSubqueriesInComparisons() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsSubqueriesInExists() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsSubqueriesInIns() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsSubqueriesInQuantifieds() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsCorrelatedSubqueries() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsUnion() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsUnionAll() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public int getMaxBinaryLiteralLength() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxCharLiteralLength() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxColumnNameLength() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxColumnsInGroupBy() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxColumnsInIndex() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxColumnsInOrderBy() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxColumnsInSelect() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxColumnsInTable() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxConnections() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxCursorNameLength() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxIndexLength() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxSchemaNameLength() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxProcedureNameLength() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxCatalogNameLength() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxRowSize() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public int getMaxStatementLength() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxStatements() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxTableNameLength() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxTablesInSelect() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getMaxUserNameLength() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getDefaultTransactionIsolation() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public boolean supportsTransactions() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsTransactionIsolationLevel(int level) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsDataManipulationTransactionsOnly() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getSchemas() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getCatalogs() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getTableTypes() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getTypeInfo() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public boolean supportsResultSetType(int type) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean ownUpdatesAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean ownDeletesAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean ownInsertsAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean othersUpdatesAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean othersDeletesAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean othersInsertsAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean updatesAreDetected(int type) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean deletesAreDetected(int type) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean insertsAreDetected(int type) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsBatchUpdates() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public Connection getConnection() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public boolean supportsSavepoints() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsNamedParameters() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsMultipleOpenResults() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsGetGeneratedKeys() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public boolean supportsResultSetHoldability(int holdability) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public int getResultSetHoldability() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getDatabaseMajorVersion() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getDatabaseMinorVersion() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getJDBCMajorVersion() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getJDBCMinorVersion() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getSQLStateType() throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public boolean locatorsUpdateCopy() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean supportsStatementPooling() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public RowIdLifetime getRowIdLifetime() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public ResultSet getClientInfoProperties() throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public ResultSet getPseudoColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public boolean generatedKeyAlwaysReturned() throws SQLException {
+        return false;
+    }
+
+    @Override
+    public <T> T unwrap(Class<T> iface) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        return false;
+    }
+}

+ 64 - 0
src/main/java/org/elasticsearch/jdbc/ElasticDriver.java

@@ -0,0 +1,64 @@
+package org.elasticsearch.jdbc;
+
+import org.elasticsearch.client.Client;
+
+import java.sql.*;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+public class ElasticDriver implements Driver {
+
+    private static final String ELASTIC_SEARCH_DRIVER_PREFIX = "jdbc:elastic:";
+
+    private Client client;
+
+    static {
+        try {
+            DriverManager.registerDriver(new ElasticDriver());
+        }
+        catch (SQLException ex) {
+            // ignore
+        }
+    }
+
+    private ElasticDriver() {
+
+    }
+
+    @Override
+    public Connection connect(String url, Properties info) throws SQLException {
+        String ipUrl = url.substring(ELASTIC_SEARCH_DRIVER_PREFIX.length());
+        Client client = TransportClientFactory.createTransportClientFromUrl(ipUrl);
+        return new ElasticConnection(url, info, client);
+    }
+
+    @Override
+    public boolean acceptsURL(String url) throws SQLException {
+        return url != null && url.startsWith(ELASTIC_SEARCH_DRIVER_PREFIX);
+    }
+
+    @Override
+    public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
+        return new DriverPropertyInfo[0];
+    }
+
+    @Override
+    public int getMajorVersion() {
+        return 1;
+    }
+
+    @Override
+    public int getMinorVersion() {
+        return 0;
+    }
+
+    @Override
+    public boolean jdbcCompliant() {
+        return true;
+    }
+
+    @Override
+    public Logger getParentLogger() throws SQLFeatureNotSupportedException {
+        throw new UnsupportedOperationException("getParentLogger");
+    }
+}

+ 60 - 0
src/main/java/org/elasticsearch/jdbc/ElasticResultSet.java

@@ -0,0 +1,60 @@
+package org.elasticsearch.jdbc;
+
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+public class ElasticResultSet extends AbstractResultSet {
+
+    public static final ElasticResultSetMetaData resultSetMetaData = new ElasticResultSetMetaData();
+
+    private String searchResultJson;
+
+    private int rowCursor = 0;
+
+    public ElasticResultSet(Statement statement, String searchResultJson) {
+        super(statement);
+        this.searchResultJson = searchResultJson;
+    }
+
+    @Override
+    public boolean next() throws SQLException {
+        rowCursor++;
+        return rowCursor <= 1;
+    }
+
+    @Override
+    public void beforeFirst() throws SQLException {
+        rowCursor = 0;
+    }
+
+    @Override
+    public void afterLast() throws SQLException {
+        rowCursor = 1;
+    }
+
+    @Override
+    public String getString(int columnIndex) throws SQLException {
+        return searchResultJson;
+    }
+
+    @Override
+    public String getString(String columnLabel) throws SQLException {
+        return searchResultJson;
+    }
+
+    @Override
+    public int getRow() throws SQLException {
+        return rowCursor;
+    }
+
+    @Override
+    public int getFetchSize() throws SQLException {
+        return 1;
+    }
+
+    @Override
+    public ResultSetMetaData getMetaData() throws SQLException {
+        return resultSetMetaData;
+    }
+}

+ 132 - 0
src/main/java/org/elasticsearch/jdbc/ElasticResultSetMetaData.java

@@ -0,0 +1,132 @@
+package org.elasticsearch.jdbc;
+
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Types;
+
+public class ElasticResultSetMetaData implements ResultSetMetaData {
+
+    protected static final String JSON_DATA_COL_NAME = "json_result";
+
+    @Override
+    public int getColumnCount() throws SQLException {
+        return 1;
+    }
+
+    @Override
+    public boolean isAutoIncrement(int column) throws SQLException {
+        return true;
+    }
+
+    @Override
+    public boolean isCaseSensitive(int column) throws SQLException {
+        return true;
+    }
+
+    @Override
+    public boolean isSearchable(int column) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean isCurrency(int column) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public int isNullable(int column) throws SQLException {
+        return columnNoNulls;
+    }
+
+    @Override
+    public boolean isSigned(int column) throws SQLException {
+        return false;
+    }
+
+
+    @Override
+    public int getColumnDisplaySize(int column) throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public String getColumnLabel(int column) throws SQLException {
+        return JSON_DATA_COL_NAME;
+    }
+
+    @Override
+    public String getColumnName(int column) throws SQLException {
+        return JSON_DATA_COL_NAME;
+    }
+
+    @Override
+    public String getSchemaName(int column) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public int getPrecision(int column) throws SQLException {
+        return 0;
+    }
+
+    @Override
+    public int getScale(int column) throws SQLException {
+        return 0;
+    }
+
+
+    @Override
+    public String getTableName(int column) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public String getCatalogName(int column) throws SQLException {
+        return null;
+    }
+
+    @Override
+    public int getColumnType(int column) throws SQLException {
+        return Types.VARCHAR;
+    }
+
+    @Override
+    public String getColumnTypeName(int column) throws SQLException {
+        return "String";
+    }
+
+    @Override
+    public boolean isReadOnly(int column) throws SQLException {
+        return true;
+    }
+
+
+    @Override
+    public boolean isWritable(int column) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public boolean isDefinitelyWritable(int column) throws SQLException {
+        return false;
+    }
+
+    @Override
+    public String getColumnClassName(int column) throws SQLException {
+        return String.class.toString();
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public final <T> T unwrap(final Class<T> iface) throws SQLException {
+        if (isWrapperFor(iface)) {
+            return (T) this;
+        }
+        throw new SQLException(String.format("[%s] cannot be unwrapped as [%s]", getClass().getName(), iface.getName()));
+    }
+
+    @Override
+    public final boolean isWrapperFor(final Class<?> iface) throws SQLException {
+        return iface.isInstance(this);
+    }
+}

+ 195 - 0
src/main/java/org/elasticsearch/jdbc/ElasticSingleConnectionDataSource.java

@@ -0,0 +1,195 @@
+package org.elasticsearch.jdbc;
+
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+public class ElasticSingleConnectionDataSource extends DriverManagerDataSource implements SmartDataSource {
+
+    private boolean suppressClose;
+
+    private Connection target;
+
+    private Connection connection;
+
+    private final Object connectionMonitor = new Object();
+
+    public ElasticSingleConnectionDataSource() {
+
+    }
+
+    public ElasticSingleConnectionDataSource(String url, boolean suppressClose) {
+        super(url);
+        this.suppressClose = suppressClose;
+    }
+
+    public ElasticSingleConnectionDataSource(Connection target, boolean suppressClose) {
+        this.target = target;
+        this.suppressClose = suppressClose;
+        this.connection = (suppressClose ? getCloseSuppressingConnectionProxy(target) : target);
+    }
+
+    public ElasticSingleConnectionDataSource(String url, String username, String password, boolean suppressClose) {
+        super(url, username, password);
+        this.suppressClose = suppressClose;
+    }
+
+    public void setSuppressClose(boolean suppressClose) {
+        this.suppressClose = suppressClose;
+    }
+
+
+    protected boolean isSuppressClose() {
+        return this.suppressClose;
+    }
+
+
+    public void setAutoCommit(boolean autoCommit) {
+        // ignore
+    }
+
+
+    protected Boolean getAutoCommitValue() {
+        return Boolean.FALSE;
+    }
+
+
+    @Override
+    public Connection getConnection() throws SQLException {
+        synchronized (this.connectionMonitor) {
+            if (this.connection == null) {
+                // No underlying Connection -> lazy init via DriverManager.
+                initConnection();
+            }
+            if (this.connection.isClosed()) {
+                throw new SQLException(
+                        "Connection was closed in ElasticSingleConnectionDataSource. Check that user code checks " +
+                                "shouldClose() before closing Connections, or set 'suppressClose' to 'true'");
+            }
+            return this.connection;
+        }
+    }
+
+    @Override
+    public Connection getConnection(String username, String password) throws SQLException {
+        return getConnection();
+    }
+
+
+    public boolean shouldClose(Connection con) {
+        synchronized (this.connectionMonitor) {
+            return (con != this.connection && con != this.target);
+        }
+    }
+
+    public void destroy() {
+        synchronized (this.connectionMonitor) {
+            closeConnection();
+        }
+    }
+
+
+    public void initConnection() throws SQLException {
+        if (getUrl() == null) {
+            throw new IllegalStateException("'url' property is required for lazily initializing a Connection");
+        }
+        synchronized (this.connectionMonitor) {
+            closeConnection();
+            this.target = getConnectionFromDriver(getUsername(), getPassword());
+            prepareConnection(this.target);
+            this.connection = (isSuppressClose() ? getCloseSuppressingConnectionProxy(this.target) : this.target);
+        }
+    }
+
+
+    public void resetConnection() {
+        synchronized (this.connectionMonitor) {
+            closeConnection();
+            this.target = null;
+            this.connection = null;
+        }
+    }
+
+
+    protected void prepareConnection(Connection con) throws SQLException {
+        Boolean autoCommit = getAutoCommitValue();
+        if (autoCommit != null && con.getAutoCommit() != autoCommit) {
+            con.setAutoCommit(autoCommit);
+        }
+    }
+
+
+    private void closeConnection() {
+        if (this.target != null) {
+            try {
+                this.target.close();
+            }
+            catch (Throwable ex) {
+                //logger.warn("Could not close shared JDBC Connection", ex);
+            }
+        }
+    }
+
+
+    protected Connection getCloseSuppressingConnectionProxy(Connection target) {
+        return (Connection) Proxy.newProxyInstance(
+                ConnectionProxy.class.getClassLoader(),
+                new Class[]{ConnectionProxy.class},
+                new CloseSuppressingInvocationHandler(target));
+    }
+
+
+    private static class CloseSuppressingInvocationHandler implements InvocationHandler {
+        private final Connection target;
+        public CloseSuppressingInvocationHandler(Connection target) {
+            this.target = target;
+        }
+
+        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+            // Invocation on ConnectionProxy interface coming in...
+
+            if (method.getName().equals("equals")) {
+                // Only consider equal when proxies are identical.
+                return (proxy == args[0]);
+            }
+            else if (method.getName().equals("hashCode")) {
+                // Use hashCode of Connection proxy.
+                return System.identityHashCode(proxy);
+            }
+            else if (method.getName().equals("unwrap")) {
+                if (((Class) args[0]).isInstance(proxy)) {
+                    return proxy;
+                }
+            }
+            else if (method.getName().equals("isWrapperFor")) {
+                if (((Class) args[0]).isInstance(proxy)) {
+                    return true;
+                }
+            }
+            else if (method.getName().equals("close")) {
+                // Handle close method: don't pass the call on.
+                return null;
+            }
+            else if (method.getName().equals("isClosed")) {
+                return false;
+            }
+            else if (method.getName().equals("getTargetConnection")) {
+                // Handle getTargetConnection method: return underlying Connection.
+                return this.target;
+            }
+
+            // Invoke method on target Connection.
+            try {
+                return method.invoke(this.target, args);
+            }
+            catch (InvocationTargetException ex) {
+                throw ex.getTargetException();
+            }
+        }
+    }
+
+}

+ 48 - 0
src/main/java/org/elasticsearch/jdbc/ElasticStatement.java

@@ -0,0 +1,48 @@
+package org.elasticsearch.jdbc;
+
+import org.elasticsearch.action.search.SearchRequestBuilder;
+import org.elasticsearch.action.search.SearchResponse;
+import org.elasticsearch.dsl.bean.ElasticSqlParseResult;
+import org.elasticsearch.dsl.parser.ElasticSql2DslParser;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+public class ElasticStatement extends AbstractStatement {
+
+    protected ElasticConnection connection;
+
+    public ElasticStatement(ElasticConnection connection) {
+        this.connection = connection;
+    }
+
+    private ResultSet executeResult;
+
+    @Override
+    public ResultSet executeQuery(String sql) throws SQLException {
+        ElasticSql2DslParser sql2DslParser = new ElasticSql2DslParser();
+        ElasticSqlParseResult parseResult = sql2DslParser.parse(sql);
+
+        SearchRequestBuilder searchRequest = parseResult.toRequest(connection.getClient());
+        SearchResponse searchResponse = searchRequest.execute().actionGet();
+
+        return executeResult = new ElasticResultSet(this, searchResponse.toString());
+    }
+
+    @Override
+    public boolean execute(String sql) throws SQLException {
+        executeQuery(sql);
+        return true;
+    }
+
+    @Override
+    public ResultSet getResultSet() throws SQLException {
+        return executeResult;
+    }
+
+    @Override
+    public Connection getConnection() throws SQLException {
+        return connection;
+    }
+}

+ 4 - 0
src/main/java/org/elasticsearch/jdbc/SearchActionExecutor.java

@@ -0,0 +1,4 @@
+package org.elasticsearch.jdbc;
+
+public class SearchActionExecutor {
+}

+ 10 - 0
src/main/java/org/elasticsearch/jdbc/SmartDataSource.java

@@ -0,0 +1,10 @@
+package org.elasticsearch.jdbc;
+
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+
+
+public interface SmartDataSource extends DataSource {
+    boolean shouldClose(Connection con);
+}

+ 63 - 0
src/main/java/org/elasticsearch/jdbc/TransportClientFactory.java

@@ -0,0 +1,63 @@
+package org.elasticsearch.jdbc;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import org.elasticsearch.client.transport.TransportClient;
+import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.transport.InetSocketTransportAddress;
+
+import java.net.InetSocketAddress;
+import java.util.List;
+import java.util.Map;
+
+public class TransportClientFactory {
+
+    private static final String COMMA = ",";
+    private static final String COLON = ":";
+    private static final int DEFAULT_ES_PORT = 9300;
+
+    private static final Map<String, TransportClient> clientMap = Maps.newConcurrentMap();
+
+    private TransportClientFactory() {
+
+    }
+
+    public static TransportClient createTransportClientFromUrl(String url) {
+        if (clientMap.containsKey(url)) {
+            return clientMap.get(url);
+        }
+
+        Settings.Builder settingBuilder = Settings.settingsBuilder();
+        settingBuilder.put("client.transport.sniff", true);
+
+        String hostListString = url;
+        int clusterNamePosIdx = url.lastIndexOf("/");
+        if (clusterNamePosIdx >= 0) {
+            hostListString = hostListString.substring(0, clusterNamePosIdx);
+            settingBuilder.put("cluster.name", url.substring(clusterNamePosIdx + 1));
+        }
+        else {
+            settingBuilder.put("client.transport.ignore_cluster_name", true);
+        }
+
+        List<InetSocketTransportAddress> addressList = Lists.newLinkedList();
+
+        String[] connStringList = hostListString.split(COMMA);
+        for (String connStr : connStringList) {
+            String[] connArr = connStr.split(COLON);
+            if (connArr.length == 1) {
+                addressList.add(new InetSocketTransportAddress(new InetSocketAddress(connArr[0], DEFAULT_ES_PORT)));
+            }
+            else {
+                addressList.add(new InetSocketTransportAddress(new InetSocketAddress(connArr[0], Integer.parseInt(connArr[1]))));
+            }
+        }
+
+        TransportClient transportClient = TransportClient.builder().settings(settingBuilder).build()
+                .addTransportAddresses(addressList.toArray(new InetSocketTransportAddress[addressList.size()]));
+
+        clientMap.put(url, transportClient);
+
+        return clientMap.get(url);
+    }
+}

+ 61 - 0
src/test/java/org/elasticsearch/jdbc/ElasticDriverTest.java

@@ -0,0 +1,61 @@
+package org.elasticsearch.jdbc;
+
+
+import org.junit.Test;
+
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.util.Enumeration;
+
+public class ElasticDriverTest {
+    private static final String driver = "org.elasticsearch.jdbc.ElasticDriver";
+    private static final String url = "jdbc:elastic:192.168.0.109:9300/judge_cluster";
+
+
+    @Test
+    public void testLoadDriver() throws Exception {
+        Class.forName(driver);
+
+        Enumeration<Driver> driverEnumeration = DriverManager.getDrivers();
+
+        while (driverEnumeration.hasMoreElements()) {
+            Driver driver = driverEnumeration.nextElement();
+            System.out.println(driver.toString());
+        }
+    }
+
+    @Test
+    public void testGetConnection() throws Exception {
+        Class.forName(driver);
+        Connection connection = DriverManager.getConnection(url);
+        org.junit.Assert.assertTrue(connection instanceof ElasticConnection);
+    }
+
+    @Test
+    public void testDataSource() throws Exception {
+        ElasticSingleConnectionDataSource dataSource = new ElasticSingleConnectionDataSource(url, false);
+        dataSource.setDriverClassName(driver);
+
+        Connection connection = dataSource.getConnection();
+        org.junit.Assert.assertTrue(connection instanceof ElasticConnection);
+
+        dataSource.destroy();
+        org.junit.Assert.assertTrue(connection.isClosed());
+    }
+
+    @Test
+    public void testQuery() throws Exception {
+        ElasticSingleConnectionDataSource dataSource = new ElasticSingleConnectionDataSource(url, true);
+        dataSource.setDriverClassName(driver);
+
+        Connection connection = dataSource.getConnection();
+        ResultSet resultSet = connection.createStatement().executeQuery("select * from index.library where manager.managerName='lcy'");
+
+        while(resultSet.next()) {
+            String json = resultSet.getString(1);
+            System.out.println(json);
+        }
+    }
+}

+ 1 - 1
src/test/java/org/elasticsearch/SqlParserLimitTest.java

@@ -1,4 +1,4 @@
-package org.elasticsearch;
+package org.elasticsearch.query;
 
 import org.elasticsearch.dsl.bean.ElasticSqlParseResult;
 import org.elasticsearch.dsl.parser.ElasticSql2DslParser;

+ 1 - 1
src/test/java/org/elasticsearch/SqlParserListenerTest.java

@@ -1,4 +1,4 @@
-package org.elasticsearch;
+package org.elasticsearch.query;
 
 import org.elasticsearch.dsl.bean.ElasticSqlParseResult;
 import org.elasticsearch.dsl.bean.ElasticSqlQueryField;

+ 1 - 1
src/test/java/org/elasticsearch/SqlParserOrderByTest.java

@@ -1,4 +1,4 @@
-package org.elasticsearch;
+package org.elasticsearch.query;
 
 import org.elasticsearch.dsl.bean.ElasticSqlParseResult;
 import org.elasticsearch.dsl.parser.ElasticSql2DslParser;

+ 1 - 1
src/test/java/org/elasticsearch/SqlParserQueryTest.java

@@ -1,4 +1,4 @@
-package org.elasticsearch;
+package org.elasticsearch.query;
 
 import org.elasticsearch.dsl.bean.ElasticSqlParseResult;
 import org.elasticsearch.dsl.parser.ElasticSql2DslParser;

+ 1 - 1
src/test/java/org/elasticsearch/SqlParserRoutingTest.java

@@ -1,4 +1,4 @@
-package org.elasticsearch;
+package org.elasticsearch.query;
 
 import org.elasticsearch.dsl.bean.ElasticSqlParseResult;
 import org.elasticsearch.dsl.parser.ElasticSql2DslParser;

+ 1 - 1
src/test/java/org/elasticsearch/SqlParserSelectFieldTest.java

@@ -1,4 +1,4 @@
-package org.elasticsearch;
+package org.elasticsearch.query;
 
 import org.apache.commons.collections.CollectionUtils;
 import org.elasticsearch.dsl.bean.ElasticSqlParseResult;

+ 2 - 2
src/test/java/org/elasticsearch/SqlParserWhereConditionTest.java

@@ -1,4 +1,4 @@
-package org.elasticsearch;
+package org.elasticsearch.query;
 
 import org.elasticsearch.action.search.SearchAction;
 import org.elasticsearch.action.search.SearchRequestBuilder;
@@ -10,7 +10,7 @@ import org.elasticsearch.index.query.QueryBuilders;
 import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
 import org.elasticsearch.search.aggregations.AggregationBuilders;
 import org.elasticsearch.search.aggregations.bucket.terms.TermsBuilder;
-import org.elasticsearch.util.ElasticMockClient;
+import org.elasticsearch.client.ElasticMockClient;
 import org.junit.Assert;
 import org.junit.Test;