After installing elastic search it is useful for testing and training to load some sample data.
1) create mapping :
curl -XPUT http://localhost:9200/shakespeare -d '
{
"mappings" : {
"_default_" : {
"properties" : {
"speaker" : {"type": "string", "index" : "not_analyzed" },
"play_name" : {"type": "string", "index" : "not_analyzed" },
"line_id" : { "type" : "integer" },
"speech_number" : { "type" : "integer" }
}
}
}
}
';
2) Load the data using the bulk api:
wget "https://github.com/ropensci/elastic_data/blob/master/data/shakespeare_data.json?raw=true" -O shakespeare.json curl -XPUT localhost:9200/_bulk --data-binary @shakespeare.json
nJoy 😉
