I'm currently integrating the elasticsearch java api in my api-rest project. About it, Im' using the dependency JAX-RS. All is working fine but there is a little problem which bothers me. I will explain it.
I don't know if I'm doing this in the good way but there is the scenari of a call to my api endpoint using the elasticsarch java api :
- Calling the ressource
- Checking the securityContext (specific to my api rest app)
- Opening the elasticsearch client
- Doing my query by using SearchResponse
- Closing my client
- Return the response
The little issue is located when I'm closing the client, indeed this step takes between 1 and 2 seconds. It's not a big deal but for what I'm using it,e.g datas vizualisation on a front-end dashboard, it's a little bit slow.
So what I'm aksing to you it's if my scenari is good , if I'm doing right to close the client at this time and if it's normal that it's take a while to close it ?
Thanks in advance and sorry for the english level, forgive the frenchy I am.