I'd use a bool query with multiple should clauses. One would be set with a phrase query and the other one as a match query.
I wrote a full (but complex example) here: https://gist.github.com/dadoonet/5179ee72ecbf08f12f53d4bda1b76bab
Should give something like:
GET oss/_search
{
"query": {
"bool": {
"should": [
{
"match_phrase": {
"name": {
"query" : "david",
"boost": 8.0
}
}
},
{
"match": {
"name": {
"query": "david"
}
}
}
]
}
}
}