In a clustered environment for around 10,000 record to be indexed it is taking almost 10 minutes.
Same is the problem when we search something in those index data through the hibernate search.
I know problem is at elastic side only as it is not fine tune to cope up the requirements (query directly in elastic cluster is also taking too much time to return result).
Any valuable resource for guidance on this is appreciated.
PS: elastic cluster is build originally for elk stack and we are using same server having other data as well.
Also please let me know how to increase the chunk size in bulk index (currently it is 50 only)
and I used like this
searchSession.massIndexer().threadsToLoadObjects(6).startAndWait();
You mean sending search queries to Elasticsearch via curl
or similar, i.e. direct REST requests, is slow too? If that’s the case, there isn’t much Hibernate Search can do to help. Your Elasticsearch cluster is slow, so you should look into solving that first.
Perhaps the Elasticsearch forums will be have some advice for you. Post something there and maybe someone will help, but be sure to include more information, like the specs of your server(s), the request you sent and how slow it was, the current load including other applications, your custom configuration on the Elasticsearch side, etc.
You did not say which version of Hibernate Search you are using, so I will assume 6, the latest.
See batchSizeToLoadObjects
here to configure how many entities are loaded in each query to the database.
See hibernate.search.backend.indexing.max_bulk_size
here to configure how many documents (at most) are sent to the Elasticsearch cluster in each HTTP request. A word of warning: multiple requests can be sent in parallel. If you increase the bulk size or parallelism too much, there’s a risk of overloading Elasticsearch if it doesn’t have enough memory available to handle your large bulks, and in that case the indexing will start failing.
In Hibernate Search 5, the maximum Elasticsearch bulk size cannot be configured and is always 250
.