GET /facility_search_test/_search
{
"query": {
"match_phrase_prefix": {
"address": {
"query": "11575",
"boost": 1,
"analyzer": "my_synonyms"
}
}
}
}
以上是我的dsl
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 12,
"max_score": 10.836019,
"hits": [
{
"_index": "facility_search",
"_type": "facility_search",
"_id": "AX1Z3DMBWXp1KnQKVYmC",
"_score": 10.836019,
"_source": {
"address": "144 Nassau Rd Roosevelt, NY 11575 USA"
}
},
{
"_index": "facility_search",
"_type": "facility_search",
"_id": "AX1Z56sqWXp1KnQKVxJF",
"_score": 10.836019,
"_source": {
"address": "322 Nassau Rd Roosevelt, NY 11575 USA"
}
},
{
"_index": "facility_search",
"_type": "facility_search",
"_id": "1111621",
"_score": 10.836019,
"_source": {
"address": "144 Nassau Rd Roosevelt, NY 11575 USA"
}
},
{
"_index": "facility_search",
"_type": "facility_search",
"_id": "1204438",
"_score": 10.836019,
"_source": {
"address": "322 Nassau Rd Roosevelt, NY 11575 USA"
}
},
{
"_index": "facility_search",
"_type": "facility_search",
"_id": "AX1Z4Si-WXp1KnQKVfz0",
"_score": 9.298623,
"_source": {
"address": "11575 E 40th Ave, Denver, CO 80239-3376, United States"
}
},
{
"_index": "facility_search",
"_type": "facility_search",
"_id": "AX1Z6u3sWXp1KnQKV1OW",
"_score": 9.298623,
"_source": {
"address": "11575 Reading Rd, Cincinnati, OH 45241-2240, United States"
}
},
{
"_index": "facility_search",
"_type": "facility_search",
"_id": "AX1Z8wQMWXp1KnQKWGt4",
"_score": 9.298623,
"_source": {
"address": "208 Babylon Turnpike, Roosevelt, NY 11575, United States"
}
},
{
"_index": "facility_search",
"_type": "facility_search",
"_id": "AX1Z5LlSWXp1KnQKVte-",
"_score": 9.298623,
"_source": {
"address": "11575 Reading Rd, Cincinnati, OH 45241, United States"
}
},
{
"_index": "facility_search",
"_type": "facility_search",
"_id": "AX1Z4SjOWXp1KnQKVhT5",
"_score": 9.298623,
"_source": {
"address": "11575 W President Dr Boise, ID 83713 USA"
}
},
{
"_index": "facility_search",
"_type": "facility_search",
"_id": "AX1Z8DNeWXp1KnQKWBKp",
"_score": 9.298623,
"_source": {
"address": "11575 Main St #300, Broomfield, CO 80020, United States"
}
}
]
}
}
以上是返回结果。
我希望以11575开头的排在前边
3 个回复
God_lockin
赞同来自: xiaowuge
xiaowuge - 90后
赞同来自: caster_QL
如果你版本是5.X 请参考这个:
https://stackoverflow.com/ques ... earch
https://www.elastic.co/guide/e ... .html
如果你版本是6.X以上请参考这个:
https://www.elastic.co/guide/e ... .html
xiaowuge - 90后
赞同来自: