forked from IQSS/dataverse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd
executable file
·23 lines (21 loc) · 1.13 KB
/
add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
# need the following in solr/collection1/conf/schema.xml
# <field name="entityid" type="long" indexed="true" stored="true" required="true" multiValued="false" />
# <field name="type" type="string" indexed="true" stored="true" required="true" multiValued="false" />
mkdir -p data
#echo "adding to solr..."
curl -s http://localhost:8080/api/dataverses > data/dataverses.json
#curl http://localhost:8983/solr/update/json?commit=true -H 'Content-type:application/json' --data-binary @data/dataverses.json
curl -s http://localhost:8080/api/datasets > data/datasets.json
#curl http://localhost:8983/solr/update/json?commit=true -H 'Content-type:application/json' --data-binary @data/datasets.json
echo "adding to elasticsearch..."
#curl -XPOST http://localhost:9200/dataverse/datasets/1 --data-binary @data/datasets/1.dump
for type in dataverses datasets; do
mkdir -p data/$type
for i in `./json2ids data/$type.json`; do
#echo "adding $i from $type..."
curl -s http://localhost:8080/api/$type/$i/dump > data/$type/$i.dump
curl -XPOST "http://localhost:9200/dataverse/$type/$i" --data-binary @data/$type/$i.dump
echo
done;
done