-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deserialize objects as JSON for addition to elasticsearch
- Loading branch information
Showing
6 changed files
with
99 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
#!/bin/sh | ||
curl http://localhost:8983/solr/update/json?commit=true -H 'Content-type: application/json' -X POST -d '{"delete": { "query":"*:*" }}' | ||
curl -XDELETE http://localhost:9200/dataverse/ | ||
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash -x | ||
./clear | ||
sleep .5 | ||
./add | ||
# elasticsearch might need more time before query | ||
sleep 1 | ||
./query | ||
./search |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/python | ||
"""Find ids in JSON document""" | ||
import sys | ||
try: | ||
import json | ||
except ImportError: | ||
import simplejson as json | ||
import optparse | ||
parser = optparse.OptionParser(description=__doc__) | ||
options, args = parser.parse_args() | ||
|
||
if not args: | ||
print "Please supply a filename to process" | ||
sys.exit(1) | ||
|
||
json_data=open(args[0]) | ||
data = json.load(json_data) | ||
ids=[] | ||
for i in data: | ||
id = i["entityid_l"] | ||
ids.append(str(id)) | ||
print ' '.join(ids) | ||
json_data.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters