You can achieve your required result, by using the boost parameter directly in the query and querying for NAME which begins with BRIDGE, ends with BRIDGE, or which contains BRIDGE.
Adding a working example
Index Mapping:
{
"mappings": {
"properties": {
"NAME": {
"type": "keyword"
}
}
}
}
Search Query:
{
"query": {
"bool": {
"should": [
{
"query_string": {
"default_field": "NAME",
"query": "BRIDGE*",
"boost": 10
}
},
{
"query_string": {
"default_field": "NAME",
"query": "*BRIDGE",
"boost": 5
}
},
{
"query_string": {
"default_field": "NAME",
"query": "*BRIDGE*",
"boost": 1
}
}
]
}
}
}
Search Result:
"hits": [
{
"_index": "66095448",
"_type": "_doc",
"_id": "1",
"_score": 11.0,
"_source": {
"NAME": "BRIDGE CAMBODJA"
}
},
{
"_index": "66095448",
"_type": "_doc",
"_id": "3",
"_score": 6.0,
"_source": {
"NAME": "KULAMAN BRIDGE"
}
},
{
"_index": "66095448",
"_type": "_doc",
"_id": "2",
"_score": 1.0,
"_source": {
"NAME": "CAMBRIDGE APARTMENTS"
}
}
]