We are in the process of migrating for pure hibernate-search to hibernate-elasticsearch in order to scale our application. However we need to be able to modify the amounts of shards. Currently when setting “hibernate.search.default.sharding_strategy.nbr_of_shards = 1” in the hibernate.properties it is ignored and the default number of shards (5) on ES is used instead. I couldn’t see a reference to sharding or replication in the documentation, so I was wondering if this is possible?
The configuration property you mentioned (
hibernate.search.default.sharding_strategy.nbr_of_shards) is only effective in embedded Lucene mode. It does not do anything with the experimental Elasticsearch integration of Hibernate Search 5.
Sharding and replication should be configured in Elasticsearch itself, through the index settings
There isn’t any way to customize the Elasticsearch index settings within Hibernate Search at the moment.
If you create indexes yourself through the Elasticsearch REST API, you should pass the settings in the body of your HTTP request when you create the indexes.
If you let Hibernate Search create the indexes automatically (the default), your only option is to register index templates before Hibernate Search creates the indexes, and add the relevant settings in your template(s).
I created HSEARCH-3934 to address your problem in Hibernate Search 6.
Thanks for the quick reply, seems odd that this behavior isn’t available, as everything else seems very far along! Thanks for creating the issue, look forward to seeing it implemented