# How to search dynamically in the indexex from java web application

**URL:** https://discuss.elastic.co/t/how-to-search-dynamically-in-the-indexex-from-java-web-application/29604
**Category:** Elasticsearch
**Created:** [September 18, 2015, 10:10pm UTC](https://discuss.elastic.co/t/how-to-search-dynamically-in-the-indexex-from-java-web-application/29604 "2015-09-18T22:10:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![shaikkhaleel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaikkhaleel/32/4854_2.png) [@shaikkhaleel](https://discuss.elastic.co/u/shaikkhaleel)
#### Post date: [September 18, 2015, 10:10pm UTC](https://discuss.elastic.co/t/how-to-search-dynamically-in-the-indexex-from-java-web-application/29604/1 "2015-09-18T22:10:26Z")

</div>

Hi,

I have created a Spring MVC based web application. I have added the spring-data-integration libraries to that application to work with elasticsearch indices.

The architecture of the application is:

I want to create a database table and load the data (around 25 million or more records) from a CSV file using the a data integrator tool.  
Using the Logstash I want to create a elasticsearch indices on that table.  
Created a Spring MVC application and included the spring-data-elesticsearch libraries.  
Written a java class to connect the elasticsearch server and get the data .

Upto this is working fine.... Now the next thing I want is dynamically querying the data

I have a web page which will allows the end user to select the filter criteria completely dynamic  
(For example age greater or less than a number, salary greater or less than a number, location in ('aa','bb'.'cc') etc. conditional all are optional conditions.

How do we form this dynamic query and send it to elastic search to get the results.

Note: when we query on a relational database we can form the query in java code and then using the JDBC we can execute the query. I wan the similar functionality.

Any help is appreciated. If any body could guide me I am happy to contribute to the project on this.

Regards  
Khaleel

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [September 18, 2015, 10:30pm UTC](https://discuss.elastic.co/t/how-to-search-dynamically-in-the-indexex-from-java-web-application/29604/2 "2015-09-18T22:30:10Z")

</div>

Did you see the Java documentation ? [https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/search.html](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/search.html)  
[https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/query-dsl-queries.html](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/query-dsl-queries.html)

---

<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: [July 5, 2017, 11:49pm UTC](https://discuss.elastic.co/t/how-to-search-dynamically-in-the-indexex-from-java-web-application/29604/3 "2017-07-05T23:49:22Z")

</div>


