Created
February 12, 2017 11:44
-
-
Save scaint/ffc5dfb1a6a39ac511d2e7f0446456a1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
SELECT format( | |
E'{"index": {"_index": "%s", "_type": "%s", "_id": %s}}\n%s', | |
current_database() || '_users', | |
'user', | |
t.id, | |
json_build_object('username', t.username, 'email', t.email)) | |
FROM users t; |
This file contains hidden or 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
#!/bin/bash | |
time (psql -t -U some_user -d some_db < query.sql | curl -s -XPOST localhost:9200/_bulk --data-binary @-) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment