-
-
Notifications
You must be signed in to change notification settings - Fork 163
/
autocomplete_linguistic_with_admin.js
89 lines (89 loc) · 2.2 KB
/
autocomplete_linguistic_with_admin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
module.exports = {
'query': {
'bool': {
'must': [
{
'multi_match': {
'fields': ['phrase.default', 'phrase.en'],
'analyzer': 'peliasQuery',
'type': 'phrase',
'slop': 3,
'boost': 1,
'query': 'one two'
}
},
{
'multi_match': {
'fields': [
'parent.country.ngram^1',
'parent.dependency.ngram^1',
'parent.macroregion.ngram^1',
'parent.region.ngram^1',
'parent.macrocounty.ngram^1',
'parent.county.ngram^1',
'parent.localadmin.ngram^1',
'parent.locality.ngram^1',
'parent.borough.ngram^1',
'parent.neighbourhood.ngram^1',
'parent.locality_a.ngram^1',
'parent.region_a.ngram^1',
'parent.country_a.ngram^1',
'name.default^1.5',
'name.en^1.5'
],
'query': 'three',
'analyzer': 'peliasAdmin',
'type': 'cross_fields'
}
}
],
'should': [
{
'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'
}
}
]
}
},
'size': 20,
'track_scores': true,
'sort': [
'_score'
]
};