I found the answer to my question.
Here is the code:
Settings settings = ImmutableSettings
.settingsBuilder()
.put("cluster.name", "es_cluster_name"))
// Define similarity module settings
.put("similarity.custom.type", "BM25")
.put("similarity.custom.k1", 2.0f)
.put("similarity.custom.b", 1.5f)
.build();
Client client = new TransportClient(settings);
It seems that you can define the similarity modules that you want to use in the settings before creating an instance of your client.
The following is a list of similarity modules elasticsearchcurrently supported : default, BM25, DFR, IB, LMDirichlet and LMJelinekMercer. You can specify which one you want to use in the settings, as shown below:
.put("similarity.custom.type", "..." )
Each semblance has its own parameters, which you would also like to configure for proper use.
Note: Code checked at elasticsearch1.1.0.
source
share