在现场弹性搜索中提高相对于术语位置的分数

gou*_*ham 5 elasticsearch

询问

{"query":{"query_string":{"query":"name:pi*"}}}

出局

hits: [
{
    _score: 1
    _source: {
        handle: PIXIES
        name: Pixies
    }
}
{
    _score: 1
    _source: {
        handle: twentyonepilots
        name: twenty one pilots
    }
}
{
    _score: 1
    _source: {
        handle: Antonio_Pinto
        name: Antonio Pinto
    }
}
{
    _score: 1
    _source: {
        handle: null
        name: Piano Tribute Players
    }
}
{
    _score: 1
    _source: {
        handle: null
        name: Los Pinguos
    }
}
{
    _score: 1
    _source: {
        handle: null
        name: Piyush Mishra & Bhupesh Singh
    }
}
{
    _score: 1
    _source: {
        handle: pinkfloyd
        name: Pink Floyd
    }
}]
Run Code Online (Sandbox Code Playgroud)

如果您查看结果,它会将名称中的术语与pi*匹配,这是我对上述查询的期望.

但是如何编写查询以在字段中使用术语位置(位置索引)对结果进行排序.该查询的结果应该Piano Tribute Players,Pink Floyd弹出的列表的顶部.因为他们以pi*开头

关于so​​lr的类似问题:SOLR:基于搜索词在现场的位置提升