# Where to set the service endpoint with the java api?

**URL:** <https://discuss.elastic.co/t/where-to-set-the-service-endpoint-with-the-java-api/59178>\
**Category:** Elasticsearch\
**Created:** [August 29, 2016, 12:13pm UTC](https://discuss.elastic.co/t/where-to-set-the-service-endpoint-with-the-java-api/59178 "2016-08-29T12:13:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abo1](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@Abo1](https://discuss.elastic.co/u/Abo1)\
**Post date:** [August 29, 2016, 12:13pm UTC](https://discuss.elastic.co/t/where-to-set-the-service-endpoint-with-the-java-api/59178/1 "2016-08-29T12:13:10Z")

</div>

Hi!  
I'm using the java api and I can't figure out how to set the endpoint of my elastic search rest service. My service is at: "[https://myhost/els](https://myhost/els)", and I connect like this:

```
client = TransportClient.builder().settings(settings).build()
                    .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("myhost"), 443));

UpdateRequest updateRequest = new UpdateRequest();
            updateRequest.index("myindex"); <-- this is the index name and not the path, right?
            updateRequest.type("mytype");

            client.update(updateRequest).get();

```

Where do I set the path ('els')?

I have successfully searched the index with the rest client api already:

```
restClient = RestClient.builder(
                    new HttpHost("myhost", 443,"https")).build();
Response response = restClient.performRequest("POST", "/els/_search",
                    Collections.singletonMap("pretty", "true"), entity);

```

but the java api doesn't work this way.

Thanks for your help.  
Andreas

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [August 29, 2016, 12:33pm UTC](https://discuss.elastic.co/t/where-to-set-the-service-endpoint-with-the-java-api/59178/2 "2016-08-29T12:33:25Z")

</div>

It is more correct to call the thing you are calling "the java API" the "transport client" because it uses Elasticsearch's internal transport protocol. You can't use `443`, you need `9300`. It isn't HTTP, just home grown binary thrown over tcp.

---

<div class="post-metadata">

**Author:** ![Abo1](https://avatars.discourse-cdn.com/v4/letter/a/9f8e36/32.png) [@Abo1](https://discuss.elastic.co/u/Abo1)\
**Post date:** [August 30, 2016, 9:50am UTC](https://discuss.elastic.co/t/where-to-set-the-service-endpoint-with-the-java-api/59178/3 "2016-08-30T09:50:45Z")

</div>

ok, I see.  
Thanks a lot!

---

<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, 10:24pm UTC](https://discuss.elastic.co/t/where-to-set-the-service-endpoint-with-the-java-api/59178/4 "2017-07-05T22:24:08Z")

</div>


