Match_phrase_prefix and scores

Hi,
I have been working on elasticsearch and I couldn't figure it out something
about prefix search.I am trying to create a music search engine. However,
on prefix search I have some troubles.
Let me give some info about my index and mappings:

{
"testindex": {
"mappings": {
"track": {
"dynamic": "true",
"numeric_detection": true,
"properties": {
"album": {
"type": "string",
"analyzer": "music_field"
},
"artist": {
"type": "string",
"analyzer": "music_field"
},
"id": {
"type": "string"
},
"title": {
"type": "string",
"analyzer": "music_field"
}
}
}
}
}
}

Settings and main analzyers are:

{
"testindex": {
"settings": {
"index": {
"uuid": "uHDWlHxpQ22itmOcnJpi9g",
"analysis": {
"char_filter": {
"xfactor": {
"type": "mapping",
"mappings": [
"-=>"
]
},
"kesha": {
"pattern": "^([^$]+)$([^$]+)$",
"type": "pattern_replace",
"replacement": "$1s$2"
},
"pink": {
"pattern": "^([^$]+)!([^$]+)$",
"type": "pattern_replace",
"replacement": "$1i$2"
},
"sharp": {
"pattern": "^([^$]+)#([^$]+)$",
"type": "pattern_replace",
"replacement": "$1h$2"
}
},
"analyzer": {
"music_field": {
"type": "custom",
"char_filter": [
"kesha",
"sharp",
"pink",
"xfactor"
],
"filter": [
"asciifolding"
],
"tokenizer": "lowercase"
}
}
},
"number_of_replicas": "1",
"number_of_shards": "5",
"version": {
"created": "1030099"
}
}
}
}
}

After this initialization, I have 7 songs into index such as:

{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 7,
"max_score": 1,
"hits": [
{
"_index": "testindex",
"_type": "track",
"_id": "4",
"_score": 1,
"_source": {
"title": "Funhouse",
"artist": "Pink",
"album": "",
"id": "4"
}
},
{
"_index": "testindex",
"_type": "track",
"_id": "5",
"_score": 1,
"_source": {
"title": "Chica Chica",
"artist": "Pinka",
"album": "",
"id": "5"
}
},
{
"_index": "testindex",
"_type": "track",
"_id": "1",
"_score": 1,
"_source": {
"title": "Comfortably Numb",
"artist": "Pink Floyd",
"album": "",
"id": "1"
}
},
{
"_index": "testindex",
"_type": "track",
"_id": "6",
"_score": 1,
"_source": {
"title": "Fever Dream",
"artist": "Mr Pink",
"album": "",
"id": "6"
}
},
{
"_index": "testindex",
"_type": "track",
"_id": "2",
"_score": 1,
"_source": {
"title": "Brain Damage",
"artist": "Pink Floyd",
"album": "",
"id": "2"
}
},
{
"_index": "testindex",
"_type": "track",
"_id": "7",
"_score": 1,
"_source": {
"title": "Another Bullshit Song",
"artist": "Pinkafree",
"album": "",
"id": "7"
}
},
{
"_index": "testindex",
"_type": "track",
"_id": "3",
"_score": 1,
"_source": {
"title": "The Gnome",
"artist": "Pink Floyd",
"album": "",
"id": "3"
}
}
]
}
}

After that I create a query to search tracks of which artists name
startsWith "Pink".

localhost:9200/testindex/track/_search?pretty=true&search_type=dfs_query_then_fetch

{
"query": {
"match_phrase_prefix": {
"artist": {
"query": "pink"
}
}
}
}

I am expecting that Funhouse should be first one and with highest score in
the list. However result of the search is like that:

{
"took" : 4,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 7,
"max_score" : 2.3862944,
"hits" : [ {
"_index" : "testindex",
"_type" : "track",
"_id" : "5",
"_score" : 2.3862944,
"_source":{"title":"Chica Chica","artist":"Pinka","album":"","id":"5"}
}, {
"_index" : "testindex",
"_type" : "track",
"_id" : "7",
"_score" : 2.1554716,
"_source":{"title":"Another Bullshit
Song","artist":"Pinkafree","album":"","id":"7"}
}, {
"_index" : "testindex",
"_type" : "track",
"_id" : "4",
"_score" : 1.1335315,
"_source":{"title":"Funhouse","artist":"Pink","album":"","id":"4"}
}, {
"_index" : "testindex",
"_type" : "track",
"_id" : "1",
"_score" : 0.7084572,
"_source":{"title":"Comfortably Numb","artist":"Pink
Floyd","album":"","id":"1"}
}, {
"_index" : "testindex",
"_type" : "track",
"_id" : "6",
"_score" : 0.7084572,
"_source":{"title":"Fever Dream","artist":"Mr
Pink","album":"","id":"6"}
}, {
"_index" : "testindex",
"_type" : "track",
"_id" : "3",
"_score" : 0.7084572,
"_source":{"title":"The Gnome","artist":"Pink
Floyd","album":"","id":"3"}
}, {
"_index" : "testindex",
"_type" : "track",
"_id" : "2",
"_score" : 0.3039775,
"_source":{"title":"Brain Damage","artist":"Pink
Floyd","album":"","id":"2"}
} ]
}
}

I tried regex, prefix and wildcard search. However; I culdn't find a wat
for this problem.
What is the ideal way to do it?

Mehmet -

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/35a2d6c0-f9a1-4770-8336-84592b434ae6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.