Reputation: 161
I know we can boost a field like this while making a search query in Elastic Search. Can we do this in mapping by giving a field extra weight?
GET /_search
{
"query": {
"function_score": {
"field_value_factor": {
"field": "likes",
"factor": 1.2,
"modifier": "sqrt",
"missing": 1
}
}
}
}
Upvotes: 0
Views: 1360
Reputation: 161
Index time boosting boosting is deprecated in ElasticSearch 5.x and not suggested anymore.
If you want boosting just do it in search time.
Upvotes: 0
Reputation: 217274
Yes, you can do that using the boost
setting in your field declaration:
PUT my_index
{
"mappings": {
"_doc": {
"properties": {
"likes": {
"type": "integer",
"boost": 1.2 <--- add this
}
}
}
}
}
Upvotes: 1