# How to fetch data using sql query with elastic search through Sql4es jdbc\_driver?

**URL:** <https://discuss.elastic.co/t/how-to-fetch-data-using-sql-query-with-elastic-search-through-sql4es-jdbc-driver/100991>\
**Category:** Elasticsearch\
**Created:** [September 19, 2017, 8:52am UTC](https://discuss.elastic.co/t/how-to-fetch-data-using-sql-query-with-elastic-search-through-sql4es-jdbc-driver/100991 "2017-09-19T08:52:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SachArora](https://avatars.discourse-cdn.com/v4/letter/s/ecc23a/32.png) [@SachArora](https://discuss.elastic.co/u/SachArora)\
**Post date:** [September 19, 2017, 8:52am UTC](https://discuss.elastic.co/t/how-to-fetch-data-using-sql-query-with-elastic-search-through-sql4es-jdbc-driver/100991/1 "2017-09-19T08:52:50Z")

</div>

We are trying to get data from the Elasticsearch using SQL queries but if I query for 'select \* from table' it only returns fields name without field\_data. here I'm using sql4es with its jdbc\_driver for connection.  
cassandra

> > public List findAll() {  
> > try  
> > {  
> > Class.forName("nl.anchormen.sql4es.jdbc.ESDriver");  
> > connection = DriverManager.getConnection("jdbc:sql4es://localhost:9300/projectmanagement?cluster.name=TestCluster");  
> > java.sql.Statement statement = connection.createStatement();  
> > java.sql.ResultSet rs = statement.executeQuery("SELECT \* FROM user");  
> > System.out.println(rs);  
> > ResultSetMetaData rsmd = rs.getMetaData();  
> > int nrCols = rsmd.getColumnCount();  
> > while(rs.next()){  
> > for(int i=1; i\<=nrCols; i++){  
> > System.out.println(rs.getObject(i));  
> > }  
> > }  
> > rs.close();  
> > connection.close();  
> > }catch (Exception e)  
> > {  
> > System.out.println(e.getClass());  
> > e.printStackTrace();  
> > }  
> > return mapper.map(session.execute(findAllStmt.bind())).all();  
> > }

here is the list of fields\_name

 ![Screenshot from 2017-09-19 10-53-39](https://us1.discourse-cdn.com/elastic/original/3X/8/5/85b88de72f7e13ee7adcd2046f846d7cb642c24a.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 17, 2017, 8:52am UTC](https://discuss.elastic.co/t/how-to-fetch-data-using-sql-query-with-elastic-search-through-sql4es-jdbc-driver/100991/2 "2017-10-17T08:52:54Z")

</div>

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