forked from jsanz/opensky-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.ts
99 lines (94 loc) · 2.18 KB
/
config.ts
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
90
91
92
93
94
95
96
97
98
99
/* eslint-disable @typescript-eslint/camelcase */
import { GeoPointType } from './enums';
const elasticConfig = {};
if (process.env.ELASTIC_CLOUD_ID){
elasticConfig['cloud'] = {
id: process.env.ELASTIC_CLOUD_ID
}
} else {
elasticConfig['node'] = process.env.ELASTIC_HOST
};
if (process.env.ELASTIC_USER && process.env.ELASTIC_PASSWORD) {
elasticConfig['auth'] = {
username: process.env.ELASTIC_USER,
password: process.env.ELASTIC_PASSWORD,
}
}
const indices = {
flightTracking: {
indexPattern: 'flight_tracking*',
geoField: 'location',
geoType: GeoPointType.OBJECT,
body: {
size: 0,
query: {
bool: {
must: [],
filter: [
{
match_all: {},
},
{
bool: {
should: [
{
match: {
onGround: false,
},
},
],
minimum_should_match: 1,
},
},
{
range: {
timePosition: {
gte: 'now-15m/m',
},
},
},
],
should: [],
must_not: [],
},
},
aggs: {
top_hits: {
terms: {
field: 'callsign',
size: 10000,
},
aggs: {
hits: {
top_hits: {
size: 1,
docvalue_fields: ['location'],
sort: [
{
timePosition: {
order: 'desc',
},
},
],
_source: {
includes: [
'callsign',
'originCountry',
'geoAltitude',
'velocity'],
},
},
},
},
},
},
},
},
airports: {
indexPattern: 'airports',
geoField: 'coordinates',
geoType: GeoPointType.ARRAY,
fields: ['coordinates', 'featurecla', 'type', 'name', 'abbrev'],
},
};
export { elasticConfig, indices };