# Connect Hibernate Search 6.1.5.Final + Elasticsearch 8.2.X using Token based authentication

**URL:** <https://discourse.hibernate.org/t/connect-hibernate-search-6-1-5-final-elasticsearch-8-2-x-using-token-based-authentication/6409>\
**Category:** Hibernate Search\
**Created:** [June 16, 2022, 9:42am UTC](https://discourse.hibernate.org/t/connect-hibernate-search-6-1-5-final-elasticsearch-8-2-x-using-token-based-authentication/6409 "2022-06-16T09:42:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohanajjar](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mohanajjar](https://discourse.hibernate.org/u/mohanajjar)\
**Post date:** [June 16, 2022, 9:42am UTC](https://discourse.hibernate.org/t/connect-hibernate-search-6-1-5-final-elasticsearch-8-2-x-using-token-based-authentication/6409/1 "2022-06-16T09:42:09Z")

</div>

To give a feedback to this topic [https://discourse.hibernate.org/t/connect-hibernate-search-6-1-5-final-elasticsearch-8-2-x-using-a-token/6393](https://discourse.hibernate.org/t/connect-hibernate-search-6-1-5-final-elasticsearch-8-2-x-using-a-token/6393)

I configured the underlying Apache HTTP Client by implementing ElasticsearchAnalysisConfigurer with Spring Boot application as described in [https://docs.jboss.org/hibernate/stable/search/reference/en-US/html\_single/#backend-elasticsearch-configuration-http-client](https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#backend-elasticsearch-configuration-http-client)

The config files looks like :

![image](https://canada1.discourse-cdn.com/flex035/uploads/hibernate/original/2X/4/40bd9040854fbec8e9ff40f751afb16d28a6b974.png)

My costum client :

 ![es](https://canada1.discourse-cdn.com/flex035/uploads/hibernate/original/2X/d/d1706ca9ad7cc39680537122f8cfe4b1e5d204b8.png)

It works well when connecting to an elasticsearch 8.2.x running in local host but it can’t reach a remote elasticsearch :

 ![first stack](https://canada1.discourse-cdn.com/flex035/uploads/hibernate/original/2X/6/64e06851ceded84871f5f11d526c131b1360792e.png)

 ![stack 4](https://canada1.discourse-cdn.com/flex035/uploads/hibernate/original/2X/7/78a025cb733674a54ba8d21c327e28c447c9e5b7.png)

Am I missing something in the documentation?

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [June 16, 2022, 10:02am UTC](https://discourse.hibernate.org/t/connect-hibernate-search-6-1-5-final-elasticsearch-8-2-x-using-token-based-authentication/6409/2 "2022-06-16T10:02:34Z")

</div>

You seem to have hit a `NullPointerException`, which could be in the Hibernate Search code (I hope not!) or in your own.

Look for `NullPointerException` in your logs. You should see a stack trace _before_ the one you posted: that’s the one giving all the details.

EDIT: Also, upgrading to JDK 17 would help, as `NullPointerException` gives much more sensible exception messages in that version.
