Reputation: 186
I need to use property "similarity" in my elasticsearch index, but cannot find the property in the Field annotation of Springframework. It seems, the Springframework Elasticsearch library don't have that. Do I need to use another library or are there simple ways to do that? Can you recommend a library or a way?
Upvotes: 2
Views: 363
Reputation: 1771
You can use the Setting annotation and define your settings in a separate file, with the appropriate configuration for similarity.
To perform this, just add @Setting(settingPath = "/path/to/settings.json")
to your index class, where you have @Document
annotation.
e.g.
@Setting(settingPath = "/path/to/settings.json")
@Document(indexName = "indexName")
public class IndexClass {
@Id
private String id;
private String name;
// getters and setters
}
And your settings.json
should look like :
"index": {
"similarity": {
"my_similarity": {
"type": "DFR",
"basic_model": "g",
"after_effect": "l",
"normalization": "h2",
"normalization.h2.c": "3.0"
}
}
}
And you can find more in the documentation.
Upvotes: 1