{"id":15555493,"url":"https://github.com/sckott/elastic_data","last_synced_at":"2025-04-23T20:19:15.695Z","repository":{"id":23111724,"uuid":"26466108","full_name":"sckott/elastic_data","owner":"sckott","description":"Elasticsearch datasets ready for bulk loading","archived":false,"fork":false,"pushed_at":"2018-05-15T19:00:01.000Z","size":5790,"stargazers_count":45,"open_issues_count":0,"forks_count":21,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-23T20:18:59.090Z","etag":null,"topics":["bulk-loading","dataset","elastic","elasticsearch"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sckott.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-11T02:35:28.000Z","updated_at":"2024-12-07T02:50:57.000Z","dependencies_parsed_at":"2022-08-21T20:10:55.691Z","dependency_job_id":null,"html_url":"https://github.com/sckott/elastic_data","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckott%2Felastic_data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckott%2Felastic_data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckott%2Felastic_data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckott%2Felastic_data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sckott","download_url":"https://codeload.github.com/sckott/elastic_data/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250506147,"owners_count":21441723,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bulk-loading","dataset","elastic","elasticsearch"],"created_at":"2024-10-02T15:09:31.605Z","updated_at":"2025-04-23T20:19:15.677Z","avatar_url":"https://github.com/sckott.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"elastic datasets\n================\n\nThis is a collection of smallish datasets to use for playing with Elasticsearch.\n\nYou can only fit so much data in an R package. The R client for Elasticsearch we maintain\n[elastic](https://github.com/ropensci/elastic) comes with some data, but of course \nit's nice to have more, so here it is.\n\nSee also [nodbi](https://github.com/ropensci/nodbi) for working with Elasticsearch from R.\n\n## Datasets\n\n* `plos_everything.json`\n* `plos_introductions.json`\n* `plos_data.json`\n* `geonames_elastic_bulk.zip` - too big for gitub, [at dropbox](https://www.dropbox.com/s/8vcrt3g2d0pfw8l/geonames_elastic_bulk.zip?dl=0)\n* `gbif_data.json`\n* `gbif_geo.json`\n* `gbif_geopoint.json`\n* `gbif_geoshape.json`\n* `gbif_geosmall.json`\n* `shakespeare_data.json`\n* `omdb.json`\n\n## Loading into ES\n\nThese datasets are formatted to be ready for bulk loading into Elasticsearch\nvia the [bulk API](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-bulk.html)\n\n### geonames\n\n`geonames_elastic_bulk.zip` is about 70 `.json` files in Elasticsearch bulk format. It was prepared from the [Geonames](http://www.geonames.org/) database at [http://download.geonames.org/export/dump/](http://download.geonames.org/export/dump/). The original data from Geonames was licensed under a Creative Commons Attribution 3.0 License, see [http://creativecommons.org/licenses/by/3.0/](http://creativecommons.org/licenses/by/3.0/).\n\nTo load the geonames data into Elasticsearch, do as you wish, but e.g., in R you could do:\n\nFirst, create the index and set the `geo_shape` mapping\n\n```r\nbody \u003c- '{\n \"mappings\": {\n   \"record\": {\n     \"properties\": {\n         \"location\" : {\"type\" : \"geo_shape\"}\n      }\n   }\n }\n}'\nindex_create(index='geonames', body=body)\n```\n\nshould return\n\n```r\n#\u003e $acknowledged\n#\u003e [1] TRUE\n```\n\nNote: the index type is `record`, and the index name is `geonames`. The index and index type were set in the json files.\n\nThen use a for loop to load in each file. AKAIK there is a limit on the file size you can load in (let me know if there's a way to get around it), so that's why theres a bunch of json files instead of one big file.\n\n```r\ndevtools::install_github(\"ropensci/elastic\")\nlibrary(\"elastic\")\nfiles \u003c- list.files(\"path/to/unzipped/files\")\nfor(i in seq_along(files)){\n  invisible(\n    docs_bulk(\n      sprintf(\"path/geonames%s.json\", files[i])\n    )\n  )\n}\n```\n\nThe `docs_bulk()` function uses the `/_bulk` endpoint to `POST` data to an index called `geonames` in your ES server. The output of the bulk load call prints info, that's why we use `invisible()` so you don't get thousands of lines printed.\n\nCheck that it worked:\n\n```r\nSearch(\"geonames\")$hits$total\n#\u003e [1] 6646030\n```\n\nYou should have ~ 6.6 million records\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsckott%2Felastic_data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsckott%2Felastic_data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsckott%2Felastic_data/lists"}