index="interest_rate"
type="rate"
curl -XDELETE localhost:9200/${index}
curl -XPUT localhost:9200/${index}
curl -XPUT localhost:9200/${index}/${type}/_mapping -d @rate_mapping.json
ruby interest_rate.rb |
while read line
do
id=$(echo $line | jq -c '.id' | tr -d "\n")
echo "{ \"index\" : { \"_index\" : \"${index}\", \"_type\" : \"${type}\", \"_id\" : ${id}} }\n$line" | curl -XPOST localhost:9200/_bulk --data-binary @-
done
syou6162 / interest_rate Goto Github PK
View Code? Open in Web Editor NEW国債の長期金利をelasticsearchに追加していくプログラム