java.sql.SQLException: Server sent bad type [illegal_argument_exception]. Original type was [request [/_xpack/sql] contains unrecognized parameter


I am indexing some data and trying to fetch out using JDBCDataSource connection.
ES server version: 6.2.4 ( Docker container)
ES elasticsearch.plugin: 6.3.0
ES rest-high-level-client: 6.3.2

Getting an error:
java.sql.SQLException: Server sent bad type [illegal_argument_exception]. Original type was [request [/_xpack/sql] contains unrecognized parameter: [mode]]. [java.lang.IllegalArgumentException: request [/_xpack/sql] contains unrecognized parameter: [mode]


public void testBlogSolution() throws IOException, SQLException {
	RestHighLevelClient client = new RestHighLevelClient(
            RestClient.builder(new HttpHost("localhost", 9200, "http"))
                .setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
                    public RequestConfig.Builder customizeRequestConfig(RequestConfig.Builder requestConfigBuilder) {

                        return requestConfigBuilder.setConnectTimeout(5000)

	String jsonObject = "{\"age\":10,\"dateOfBirth\":1471466076564,"
		      +"\"fullName\":\"John Doe\"}";

Map<String,String> map = new HashMap<String, String>();
String str = "{"age":10,"dateOfBirth":1471466076564,"
+""fullName":"John Doe"}";

IndexRequest indexRequest = new IndexRequest("nindex", "nitesh");

indexRequest.source(str, XContentType.JSON);
IndexResponse indexResponse = client.index(indexRequest);

//Fetching data

JdbcDataSource dataSource = new JdbcDataSource();
String address = "jdbc:es://" + "localhost:9200";
Properties connectionProperties = new Properties();
Connection connection = DriverManager.getConnection(address, connectionProperties);

//Properties properties = new Properties();
//properties.put("user", "test_admin");
//properties.put("password", "x-pack-test-password");

try {
Statement statement = connection.createStatement();
ResultSet results = statement.executeQuery(


} catch (SQLException e) {
// TODO Auto-generated catch block


Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:


This is the icon to use if you are not using markdown format:

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.

ES server version: 6.2.4 ( Docker container)

You need elasticsearch server 6.3 to have access to this feature.

Thanks David. its working now, however another issue popup saying "current license is non-compliant for [jdbc]"

I took note on formatting for next issue.

Nitesh Agrawal

Hi @agrawal,
Indeed, the JDBC driver is a Platinum feature. Have a look here (and expand Management & Tooling section) for details about this.


1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.