I have data like
id, title
- 'Deploying SQL Server Databases from Test to Live'
- 'Deploying SQL Server Databases for clients'
- 'Merge SQL Server databases'
- 'SQL Server : gather data from different databases'
- .......
- ....... more then millions of records.
my search query be like
from elasticsearch import Elasticsearch
es = Elasticsearch([{'host': 'localhost', 'port': 9200}])
bd={
'query':{
'match': {
'title': "Deploying SQL Server Databases from Test to Live"
}
},
'sort': {
'_score': {
'order': 'desc'
}
}
}
res = es.search(index='abc-index', body=bd)
My search result :
{
"took": 1297,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 10000,
"relation": "gte"
},
"max_score": 38.9089,
"hits": [
{
"_index": "abc-index",
"_type": "_doc",
"_id": "1",
"_score": 38.9089, #normalized this value to some range [a,b]
"_source": {
"id": 1,
"title": "Deploying SQL Server Databases from Test to Live"
}
},
{
"_index": "abc-index",
"_type": "_doc",
"_id": "2",
"_score": 25.427029, #normalized this value to some range [a,b]
"_source": {
"id": 2,
"title": "Deploying SQL Server Databases for clients"
}
},
{
"_index": "abc-index",
"_type": "_doc",
"_id": "3",
"_score": 19.293251, #normalized this value to some range [a,b]
"_source": {
"id": 3,
"title": "Merge SQL Server databases"
}
},
{
"_index": "abc-index",
"_type": "_doc",
"_id": "4",
"_score": 18.969624, #normalized this value to some range [a,b]
"_source": {
"id": 4,
"title": "SQL Server : gather data from different databases"
}
}
.......... # 10,000 query result
]
}
}
I want _score value normalized in some range [a,b] for example [0,2].Can anyone please help me how to do that.