I'm using ES in a Spring web app. I'm working on improving performance and
found that getting the TransportClient is generally taking longer than the
actual search execution itself. Here's what I'm doing now:
I'm using ES in a Spring web app. I'm working on improving performance and found that getting the TransportClient is generally taking longer than the actual search execution itself. Here's what I'm doing now:
The Java Client needs to be kept around for the duration of the app. Its
threadsafe and "heavy". Just have a factory bean that is a singleton that
creates the client.
On Thu, Jan 12, 2012 at 10:44 PM, David Pilato david@pilato.fr wrote:
I'm using ES in a Spring web app. I'm working on improving performance and
found that getting the TransportClient is generally taking longer than the
actual search execution itself. Here's what I'm doing now:****
Using the Java API, build a FilteredQueryBuilder****
Get an instance of TransportClient something like this: getClient · GitHub****
execute the search via SearchRequestBuilder.execute.actionGet()****
close the TransportClient****
process the SearchResponse****
Is there a specific way of caching the TransportClient and reusing it
between search requests?****
Thanks for the replies. I already had a factory bean that would create a
new client for each ES operation. I've updated that factory to simply
initialize a shared client once on app start-up which performs well but
doesn't handle the case where ES or connectivity to ES is not available. To
address this, I'd like to build a retry mechanism to establish a working
client. Any special considerations needed here?
Thanks for the replies. I already had a factory bean that would create a
new client for each ES operation. I've updated that factory to simply
initialize a shared client once on app start-up which performs well but
doesn't handle the case where ES or connectivity to ES is not available. To
address this, I'd like to build a retry mechanism to establish a working
client. Any special considerations needed here?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.