mirror of https://github.com/pelias/api.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
2.5 KiB
107 lines
2.5 KiB
6 years ago
|
{
|
||
|
"type": "autocomplete",
|
||
|
"body": {
|
||
|
"query": {
|
||
|
"bool": {
|
||
|
"must": [
|
||
|
{
|
||
|
"match": {
|
||
|
"name.default": {
|
||
|
"analyzer": "peliasQueryFullToken",
|
||
|
"type": "phrase",
|
||
|
"boost": 1,
|
||
|
"slop": 3,
|
||
|
"query": "foo"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
"should": [
|
||
|
{
|
||
|
"match": {
|
||
|
"phrase.default": {
|
||
|
"analyzer": "peliasPhrase",
|
||
|
"type": "phrase",
|
||
|
"boost": 1,
|
||
|
"slop": 3,
|
||
|
"query": "foo"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"function_score": {
|
||
|
"query": {
|
||
|
"match_all": {}
|
||
|
},
|
||
|
"max_boost": 20,
|
||
|
"functions": [
|
||
|
{
|
||
|
"field_value_factor": {
|
||
|
"modifier": "log1p",
|
||
|
"field": "popularity",
|
||
|
"missing": 1
|
||
|
},
|
||
|
"weight": 1
|
||
|
}
|
||
|
],
|
||
|
"score_mode": "first",
|
||
|
"boost_mode": "replace"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"function_score": {
|
||
|
"query": {
|
||
|
"match_all": {}
|
||
|
},
|
||
|
"max_boost": 20,
|
||
|
"functions": [
|
||
|
{
|
||
|
"field_value_factor": {
|
||
|
"modifier": "log1p",
|
||
|
"field": "population",
|
||
|
"missing": 1
|
||
|
},
|
||
|
"weight": 3
|
||
|
}
|
||
|
],
|
||
|
"score_mode": "first",
|
||
|
"boost_mode": "replace"
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"bool": {
|
||
|
"should": [
|
||
|
{
|
||
|
"constant_score": {
|
||
|
"boost": 5,
|
||
|
"query": {
|
||
|
"term": {
|
||
|
"source": "openstreetmap"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
"constant_score": {
|
||
|
"boost": 3,
|
||
|
"query": {
|
||
|
"term": {
|
||
|
"layer": "transit"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
},
|
||
|
"size": 20,
|
||
|
"track_scores": true,
|
||
|
"sort": [
|
||
|
"_score"
|
||
|
]
|
||
|
}
|
||
|
}
|