# Failing to connect my java class with Elastic Search Using API

**URL:** <https://discuss.elastic.co/t/failing-to-connect-my-java-class-with-elastic-search-using-api/230428>\
**Category:** Elasticsearch\
**Created:** [April 29, 2020, 7:34pm UTC](https://discuss.elastic.co/t/failing-to-connect-my-java-class-with-elastic-search-using-api/230428 "2020-04-29T19:34:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_layall](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_layall/32/46899_2.png) [@Rahul\_layall](https://discuss.elastic.co/u/Rahul_layall)\
**Post date:** [April 29, 2020, 7:34pm UTC](https://discuss.elastic.co/t/failing-to-connect-my-java-class-with-elastic-search-using-api/230428/1 "2020-04-29T19:34:05Z")

</div>

Sir,  
How can i use the given query in my java class with sql format  
POST \_sql?format=txt  
{  
"query": "select name, from index\_name"  
}

How to write its equivalent query in my java class

---

<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:** [April 30, 2020, 8:37am UTC](https://discuss.elastic.co/t/failing-to-connect-my-java-class-with-elastic-search-using-api/230428/2 "2020-04-30T08:37:28Z")

</div>

I think it's the same question as in [How to convert and use an API query into equivalent SQL query in a java class](https://discuss.elastic.co/t/how-to-convert-and-use-an-api-query-into-equivalent-sql-query-in-a-java-class/230026)

Please be patient in waiting for responses to your question and refrain from pinging multiple times asking for a response or opening multiple topics for the same question. This is a community forum, it may take time for someone to reply to your question. For more information please refer to the [Community Code of Conduct](https://www.elastic.co/community/codeofconduct) specifically the section "Be patient". Also, please refrain from pinging folks directly, this is a forum and anyone that participates might be able to assist you.

If you are in need of a service with an SLA that covers response times for questions then you may want to consider talking to us about a [subscription](https://www.elastic.co/subscriptions).

It's fine to answer on your own thread after 2 or 3 days (not including weekends) if you don't have an answer.

---

<div class="post-metadata">

**Author:** ![Rahul\_layall](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_layall/32/46899_2.png) [@Rahul\_layall](https://discuss.elastic.co/u/Rahul_layall)\
**Post date:** [April 30, 2020, 8:56am UTC](https://discuss.elastic.co/t/failing-to-connect-my-java-class-with-elastic-search-using-api/230428/3 "2020-04-30T08:56:36Z")

</div>

Apology Sir,  
I will take care of it from next time.

---

<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:** [May 28, 2020, 8:56am UTC](https://discuss.elastic.co/t/failing-to-connect-my-java-class-with-elastic-search-using-api/230428/4 "2020-05-28T08:56:37Z")

</div>

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

---

<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:** [May 28, 2020, 8:56am UTC](https://discuss.elastic.co/t/failing-to-connect-my-java-class-with-elastic-search-using-api/230428/5 "2020-05-28T08:56:38Z")

</div>



---

<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:** [November 4, 2022, 7:56am UTC](https://discuss.elastic.co/t/failing-to-connect-my-java-class-with-elastic-search-using-api/230428/6 "2022-11-04T07:56:10Z")

</div>


