-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
67 lines (63 loc) · 2.21 KB
/
Makefile
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
ES=/home/odanoburu/builds/elasticsearch-7.0.0/bin/elasticsearch
SYNSETS_URL=sensetion-synsets
SYNSETS_PATH=data/synsets.json
DOCS_DIR=data/docs/
DOCS_URL=sensetion-docs
PORT=9200
PUT_SYNSETS="{\
\"mappings\": {\
\"properties\": {\
\"gloss\": {\
\"enabled\": false\
},\
\"terms\": {\
\"type\": \"keyword\"\
}\
}\
}\
}"
PUT_DOCS="{\
\"mappings\": {\
\"properties\": {\
\"doc_id\": {\
\"type\": \"keyword\"\
},\
\"sent_id\": {\
\"type\": \"keyword\"\
},\
\"text\": {\
\"enabled\": false\
},\
\"tokens\": {\
\"type\": \"nested\",\
\"properties\": {\
\"lemmas\": {\
\"type\": \"keyword\"\
},\
\"meta\": {\
\"enabled\": false\
},\
\"kind\": {\
\"enabled\": false\
},\
\"tag\": {\
\"enabled\": false\
},\
\"form\": {\
\"enabled\": false\
}\
}\
}\
}\
}\
}"
clean:
curl -i -H Content-Type\:\ application/json -XDELETE http://localhost:${PORT}/${SYNSETS_URL} ; echo -e '\n\n---\n'
curl -i -H Content-Type\:\ application/json -XDELETE http://localhost:${PORT}/${DOCS_URL} ; echo -e '\n\n---\n'
synsets: clean
curl -i -H Content-Type\:\ application/json -XPUT http://localhost:${PORT}/${SYNSETS_URL} -d ${PUT_SYNSETS} ; echo -e '\n\n---\n'
curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:${PORT}/${SYNSETS_URL}/_bulk --data-binary "@${SYNSETS_PATH}" &> /dev/null ; echo
docs: synsets
curl -i -H Content-Type\:\ application/json -XPUT http://localhost:${PORT}/${DOCS_URL} -d ${PUT_DOCS} ; echo -e '\n\n---\n'
for i in ${DOCS_DIR}*.json ; do curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:${PORT}/${DOCS_URL}/_bulk --data-binary "@$$i" &> /dev/null ; done ; echo
all: clean synsets docs