Can search_as_you_type field show the prefix match results firstly

i am using the search_as_you_type to auto complete, it is good, but i find the result is sorted by the score, now i need the prefix match results to come firstly, look the example blow:

POST page-new/_search
{
  "_source": {
    "includes": [
      "page_title",
      "release_status",
      "frame_id"
    ]
  },
  "size": 100, 
  "query": {
    "match_phrase_prefix": {
      "page_title.suggest_full": "流量主"
    }
  }
}

here is the result

 "hits" : [
      {
        "_index" : "wxad-page-new",
        "_type" : "_doc",
        "_id" : "314",
        "_score" : 5.161003,
        "_source" : {
          "page_title" : "开通流量主",
          "release_status" : 1,
          "frame_id" : 12
        }
      },
      {
        "_index" : "wxad-page-new",
        "_type" : "_doc",
        "_id" : "318",
        "_score" : 4.7886534,
        "_source" : {
          "page_title" : "流量主常见问题",
          "release_status" : 1,
          "frame_id" : 12
        }
      }
]

the second hit is prefix match result, i want it to show first, how can i do to make this happen.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.