-
Notifications
You must be signed in to change notification settings - Fork 0
/
es_nswcrime_setup.sh
executable file
·103 lines (93 loc) · 3.25 KB
/
es_nswcrime_setup.sh
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
100
101
102
103
#!/bin/bash
set -e -x
# cs597rmx:[email protected]
ES_HOST=localhost
ES_PORT=9200
ES_SERVER=$ES_HOST:$ES_PORT
#ES_SERVER=cs597rmx:[email protected]
# Deleting index
curl -XDELETE "http://$ES_SERVER/nswcrime/"
# Creating index
curl -XPUT "http://$ES_SERVER/nswcrime/"
# Setting up mapping types
curl -XPUT "http://$ES_SERVER/nswcrime/nswcrime/_mapping" -d '{
"nswcrime": {
"properties": {
"_source" : { "enabled" : true },
"state": {"type": "string", "store": "yes"},
"area": {"type": "string", "store": "yes", "index" : "not_analyzed"},
"area_s": {"type": "string"},
"lga_name": {"type": "string", "store": "yes", "index" : "not_analyzed"},
"lga_name_s": {"type": "string"},
"lga_location": {"type": "geo_point", "store": "yes", "lat_lon": "true"},
"offense_category": {"type": "string", "store": "yes", "index" : "not_analyzed"},
"offense_category_s": {"type": "string"},
"subcategory": {"type": "string", "store": "yes", "index" : "not_analyzed"},
"subcategory_s": {"type": "string"},
"event_date": {"type": "date", "store": "yes"},
"event_year": {"type": "integer", "store": "yes"},
"t_count": {"type": "integer", "store": "yes"}
}
}
}'
curl -XPUT "http://$ES_SERVER/nswcrime/nswcrime/1" -d '{
"state": "NSW",
"area": "Inner Sydney",
"area_s": "Inner Sydney",
"lga_name": "Botany Bay",
"lga_name_s": "Botany Bay",
"lga_location": "-34.01285,151.1257822",
"offense_category": "Homocide",
"offense_category_s": "Homocide",
"subcategory": "Murder (a)",
"subcategory_s": "Murder (a)",
"event_date": "1995-01-01T00:00:00",
"event_year": 1995,
"t_count": 5
}'
curl -XPUT "http://$ES_SERVER/nswcrime/nswcrime/2" -d '{
"state": "NSW",
"area": "Inner Sydney",
"area_s": "Inner Sydney",
"lga_name": "Botany Bay",
"lga_name_s": "Botany Bay",
"lga_location": "-34.01285,151.1257822",
"offense_category": "Homocide",
"offense_category_s": "Homocide",
"subcategory": "Murder (a)",
"subcategory_s": "Murder (a)",
"event_date": "1995-02-01T00:00:00",
"event_year": 1995,
"t_count": 6
}'
curl -XPUT "http://$ES_SERVER/nswcrime/nswcrime/3" -d '{
"state": "NSW",
"area": "Inner Sydney",
"area_s": "Inner Sydney",
"lga_name": "Botany Bay",
"lga_name_s": "Botany Bay",
"lga_location": "-34.01285,151.1257822",
"offense_category": "Homocide",
"offense_category_s": "Homocide",
"subcategory": "Murder (a)",
"subcategory_s": "Murder (a)",
"event_date": "1995-03-01T00:00:00",
"event_year": 1995,
"t_count": 8
}'
curl -XPUT "http://$ES_SERVER/nswcrime/nswcrime/4" -d '{
"state": "NSW",
"area": "Outer Sydney",
"area_s": "Outer Sydney",
"lga_name": "Croydon",
"lga_name_s": "Croydon",
"lga_location": "-34.01285,151.1257822",
"offense_category": "Homocide",
"offense_category_s": "Homocide",
"subcategory": "Murder (a)",
"subcategory_s": "Murder (a)",
"event_date": "1995-02-01T00:00:00",
"event_year": 1996,
"t_count": 6
}'
curl -XGET "http://$ES_SERVER/nswcrime/nswcrime/1"