load.sh 1003 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env bash
  2. echo "Generating bulk indexable shakespeare lines with timestamp 3 hours in the past and 5 hours into the future"
  3. node reader.js > indexme.json
  4. echo "Setting mapping for shakespeare index"
  5. curl -XPUT http://localhost:9200/_template/shakespeare -d '
  6. {
  7. "template" : "shakespeare",
  8. "mappings" : {
  9. "_default_" : {
  10. "properties" : {
  11. "clientip" : { "type" : "ip" },
  12. "speaker" : {"type": "string", "index" : "not_analyzed" },
  13. "play_name" : {"type": "string", "index" : "not_analyzed" },
  14. "line_id" : { "type" : "integer", "index": "not_analyzed" },
  15. "speech_number" : { "type" : "integer", "index": "not_analyzed" },
  16. "country" : {"type": "string", "index" : "not_analyzed" }
  17. }
  18. }
  19. }
  20. }
  21. '
  22. echo
  23. echo "Performing bulk indexing into localhost:9200"
  24. curl -XPUT localhost:9200/_bulk --data-binary @indexme.json;echo
  25. echo
  26. echo "If tons of JSON just scrolled above, I've probably successfully loaded over 100,000 lines of shakespeare into localhost:9200/shakespeare"