Where to close an Elasticsearch client connection?

限于喜欢 提交于 2020-01-05 06:57:07

问题


Where should I close the connection to a client for Elasticsearch? I am using Spring, and I don't want to use the Elasticsearch integration because I want to learn how to do it without first. Should only one client be created for the application? Meaning that it would have singleton scope? Or should it have prototype scope and close the connection for each interaction?


回答1:


You should use one client per application, make it a singleton and close on application shutdown.



来源:https://stackoverflow.com/questions/15713159/where-to-close-an-elasticsearch-client-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!