-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstate_settings.go
63 lines (54 loc) · 1.47 KB
/
state_settings.go
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
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Contributor:
// - Aaron Meihm [email protected]
package main
// Define the settings used to create the state index in ElasticSearch
type stateSettings struct {
Mappings stateMappings `json:"mappings"`
Settings inStateSettings `json:"settings"`
}
type inStateSettings struct {
Shards int `json:"number_of_shards"`
Replicas int `json:"number_of_replicas"`
}
type stateMappings struct {
GMS stateGMS `json:"geomodel_state"`
}
type stateGMS struct {
Properties stateProperties `json:"properties"`
}
type stateProperties struct {
ObjectID stateValueProperties `json:"object_id"`
ObjectIDString stateValueProperties `json:"object_id_string"`
}
type stateValueProperties struct {
Type string `json:"type"`
Index string `json:"index"`
}
// Return a stateSettings struct useful as an argument passed to
// elastigo CreateIndexWithSettings()
func getStateSettings() stateSettings {
return stateSettings{
Settings: inStateSettings{
Shards: 2,
Replicas: 1,
},
Mappings: stateMappings{
GMS: stateGMS{
Properties: stateProperties{
ObjectID: stateValueProperties{
Type: "string",
Index: "not_analyzed",
},
ObjectIDString: stateValueProperties{
Type: "string",
Index: "not_analyzed",
},
},
},
},
}
}