# Elasticsearch java Rest High level Client

**URL:** <https://discuss.elastic.co/t/elasticsearch-java-rest-high-level-client/171669>\
**Category:** Elasticsearch\
**Created:** [March 11, 2019, 5:37am UTC](https://discuss.elastic.co/t/elasticsearch-java-rest-high-level-client/171669 "2019-03-11T05:37:18Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![Dv\_Thiyanesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dv_thiyanesh/32/53965_2.png) [@Dv\_Thiyanesh](https://discuss.elastic.co/u/Dv_Thiyanesh)\
**Post date:** [March 11, 2019, 8:11am UTC](https://discuss.elastic.co/t/elasticsearch-java-rest-high-level-client/171669/21 "2019-03-11T08:11:03Z")

</div>

okay You got Me why i went to Java Rest Client Api bcz in kibana for dashboard restriction we need X-pack that's we went to java api right

Then For us our requirement is we need to combine more condition and fetch record for ex: i have index(about bank details) in elasticsearch and client need a record from (last one hour transaction details AND the Gender should be Male) when these condition matches that record should be dispalyed For that How i need to do? your idea?

---

<div class="post-metadata">

**Author:** ![Dv\_Thiyanesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dv_thiyanesh/32/53965_2.png) [@Dv\_Thiyanesh](https://discuss.elastic.co/u/Dv_Thiyanesh)\
**Post date:** [March 11, 2019, 8:12am UTC](https://discuss.elastic.co/t/elasticsearch-java-rest-high-level-client/171669/22 "2019-03-11T08:12:35Z")

</div>

mostly we use data range query for that How I proceed in java rest api?

---

<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:** [March 11, 2019, 8:17am UTC](https://discuss.elastic.co/t/elasticsearch-java-rest-high-level-client/171669/23 "2019-03-11T08:17:59Z")

</div>

You are mixing so many questions that I can not follow.

There is no relationship between security feature:

> in kibana for dashboard restriction we need X-pack that's we went to java api right

And the way you are going to request elasticsearch in Java.

> we need to combine more condition and fetch record for ex: i have index(about bank details) in elasticsearch and client need a record from (last one hour transaction details AND the Gender should be Male) when these condition matches that record should be dispalyed For that How i need to do? your idea?

You need to learn elasticsearch first.  
Forget everything about the Java client for now. Just start Elasticsearch and Kibana.  
Then go to the developer Console and start playing with elasticsearch.

If you already indexed data, just use the `GET /_search` endpoint to learn the QueryDSL.

Once you found the right query for your use case, then you can start to think about writing you code in Java. That's just another way to write a QueryDSL request.

If you need more help, please provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

---

<div class="post-metadata">

**Author:** ![Dv\_Thiyanesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dv_thiyanesh/32/53965_2.png) [@Dv\_Thiyanesh](https://discuss.elastic.co/u/Dv_Thiyanesh)\
**Post date:** [March 11, 2019, 8:58am UTC](https://discuss.elastic.co/t/elasticsearch-java-rest-high-level-client/171669/24 "2019-03-11T08:58:25Z")

</div>

In kibana Dashboard only user option is used when x-pack is activated for this case We are using java rest api to take the record out

I have learned elasticsearch and kibana that you have mentioned above But i need How to use some types of query in java for that i don't know How to code and which method used for giving multiple condition(AND,NOT,OR). i stuck in it?

---

<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:** [March 11, 2019, 9:35am UTC](https://discuss.elastic.co/t/elasticsearch-java-rest-high-level-client/171669/25 "2019-03-11T09:35:41Z")

</div>

Look at [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html)

---

<div class="post-metadata">

**Author:** ![Dv\_Thiyanesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dv_thiyanesh/32/53965_2.png) [@Dv\_Thiyanesh](https://discuss.elastic.co/u/Dv_Thiyanesh)\
**Post date:** [March 11, 2019, 10:30am UTC](https://discuss.elastic.co/t/elasticsearch-java-rest-high-level-client/171669/26 "2019-03-11T10:30:55Z")

</div>

Great it is working! but slight change is client.performRequest(request);

---

<div class="post-metadata">

**Author:** ![mashhur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mashhur/32/39553_2.png) [@mashhur](https://discuss.elastic.co/u/mashhur)\
**Post date:** [March 14, 2019, 10:09am UTC](https://discuss.elastic.co/t/elasticsearch-java-rest-high-level-client/171669/27 "2019-03-14T10:09:28Z")

</div>

I have been also using ES for several years and when it comes to upgrade ES verion, you anytime need to rewrite all you app queries. So I made very simple query builder library based on High Rest client, where you can customise later on. If you dont mind you can freely use it.

> <https://github.com/mashhur/java-elasticsearch-querybuilder/blob/master/README.md>

---

<div class="post-metadata">

**Author:** ![Dv\_Thiyanesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dv_thiyanesh/32/53965_2.png) [@Dv\_Thiyanesh](https://discuss.elastic.co/u/Dv_Thiyanesh)\
**Post date:** [March 14, 2019, 10:18am UTC](https://discuss.elastic.co/t/elasticsearch-java-rest-high-level-client/171669/28 "2019-03-14T10:18:17Z")

</div>

Instead of using this, we can use querybuilders methods itself know?  
any difference?

---

<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:** [April 11, 2019, 10:18am UTC](https://discuss.elastic.co/t/elasticsearch-java-rest-high-level-client/171669/29 "2019-04-11T10:18:21Z")

</div>

Closed on April 11, 2019, 10:18am UTC

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

[Previous page](https://discuss.elastic.co/t/elasticsearch-java-rest-high-level-client/171669.md?page=1)
