{"id":21134404,"url":"https://github.com/royrusso/elasticsearch-sample-index","last_synced_at":"2025-07-09T02:32:22.432Z","repository":{"id":8470615,"uuid":"10070231","full_name":"royrusso/elasticsearch-sample-index","owner":"royrusso","description":"Sample Index script for ElasticSearch. Includes data CSV.","archived":false,"fork":false,"pushed_at":"2019-03-11T18:09:11.000Z","size":151,"stargazers_count":25,"open_issues_count":2,"forks_count":16,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-04-01T07:16:56.130Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/royrusso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-15T03:24:31.000Z","updated_at":"2021-07-28T11:20:30.000Z","dependencies_parsed_at":"2022-09-16T12:40:23.489Z","dependency_job_id":null,"html_url":"https://github.com/royrusso/elasticsearch-sample-index","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royrusso%2Felasticsearch-sample-index","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royrusso%2Felasticsearch-sample-index/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royrusso%2Felasticsearch-sample-index/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royrusso%2Felasticsearch-sample-index/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/royrusso","download_url":"https://codeload.github.com/royrusso/elasticsearch-sample-index/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225479404,"owners_count":17480830,"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":[],"created_at":"2024-11-20T06:28:54.539Z","updated_at":"2024-11-20T06:28:55.201Z","avatar_url":"https://github.com/royrusso.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"ElasticSearch Sample Index Data Script (PHP)\n==========================\n\nThis sample script reads from the included CSV file and adds 150 'superhero' documents to an index 'comicbook'.\n\nI needed a way to quickly create indexes/shards and fill them with documents for my [ElasticSearch Monitoring solution](https://github.com/royrusso/elasticsearch-HQ, \"Elastic HQ\"), and so this project was born.\n\nUsage\n--------\n\n* Create the Index:\n\n```\ncurl -XPUT 'http://localhost:9200/comicbook/' -d '{\n    \"settings\" : {\n        \"index\" : {\n            \"number_of_shards\" : 3,\n            \"number_of_replicas\" : 1\n        }\n    }\n}'\n```\n\n* From command line, execute the script:\n\n```\nphp elasticput.php\n```\n\n* Script should output:\n\n```\n...\nINDEXING ROW: 15 HERO: Punisher\nRESPONSE: {\"ok\":true,\"_index\":\"comicbook\",\"_type\":\"superhero\",\"_id\":\"14\",\"_version\":1}\n\nINDEXING ROW: 16 HERO: Flash\nRESPONSE: {\"ok\":true,\"_index\":\"comicbook\",\"_type\":\"superhero\",\"_id\":\"15\",\"_version\":1}\n\nINDEXING ROW: 17 HERO: Magneto\nRESPONSE: {\"ok\":true,\"_index\":\"comicbook\",\"_type\":\"superhero\",\"_id\":\"16\",\"_version\":1}\n...\n```\n\n* Once complete, perform a search:\n\n```\nhttp://localhost:9200/comicbook/superhero/_search?q=summary:Kent\n\nhits: {\n  total: 6,\n  max_score: 0.71193624,\n  hits: [\n  {\n    _index: \"comicbook\",\n    _type: \"superhero\",\n    _id: \"89\",\n    _score: 0.71193624,\n    _source: {\n      name: \"Clark Kent\",\n      summary: \"Clark Kent is an American fictional character created by Jerry Siegel and Joe Shuster. ...\"\n  }\n},\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froyrusso%2Felasticsearch-sample-index","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froyrusso%2Felasticsearch-sample-index","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froyrusso%2Felasticsearch-sample-index/lists"}