Support of ElasticSearch search preference

Hi,

Any plans to support ?preference search query parameter?
https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-preference.

We have problems with inconsistent order of results for the same user executing the same query. ElasticSearch by default routes the query to different replicas based on adaptive replica selection. And every replica may have different document scoring which results in different sorting order. This leads to poor user experience. ElasticSearch suggests to use preference parameter by setting it to a custom value which must be always the same for the same user.

I did not find any support of this parameter in the current sources of Hibernate Search 6.0.0.Beta8 :(. Any plans for that?

Best regards,
Sergiy

Hi!

There are no plans to add this feature at the moment. You can create a ticket and we can help you implement a solution if you’re interested.

In the meantime, I believe you should be able to set a preference parameter by transforming the Elasticsearch request?

Ah cool, no need for additional support - ElasticsearchExtension provides the necessary machinery for that. I did not know that class. Thanks.

By the way there is a typo in the javadoc of ElasticsearchExtension class:
“An extension for the Elasticsearch backend, giving access to Lucene-specific features.” Lucene -> ElasticSearch.

Will fix that, thanks.