{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch-js/issues/401","repository_url":"https://api.github.com/repos/elastic/elasticsearch-js","labels_url":"https://api.github.com/repos/elastic/elasticsearch-js/issues/401/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch-js/issues/401/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch-js/issues/401/events","html_url":"https://github.com/elastic/elasticsearch-js/issues/401","id":153917629,"number":401,"title":"Easy way to bulk index a JSON Document?","user":{"login":"samechikson","id":5728532,"avatar_url":"https://avatars.githubusercontent.com/u/5728532?v=3","gravatar_id":"","url":"https://api.github.com/users/samechikson","html_url":"https://github.com/samechikson","followers_url":"https://api.github.com/users/samechikson/followers","following_url":"https://api.github.com/users/samechikson/following{/other_user}","gists_url":"https://api.github.com/users/samechikson/gists{/gist_id}","starred_url":"https://api.github.com/users/samechikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samechikson/subscriptions","organizations_url":"https://api.github.com/users/samechikson/orgs","repos_url":"https://api.github.com/users/samechikson/repos","events_url":"https://api.github.com/users/samechikson/events{/privacy}","received_events_url":"https://api.github.com/users/samechikson/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-05-10T03:38:26Z","updated_at":"2016-05-12T17:16:12Z","closed_at":"2016-05-10T04:28:49Z","body":"Hi, is there an easy way to bulk index a normal JSON document rather than formatting data to look like \r\n```\r\n[\r\n    // action description\r\n    { index:  { _index: 'myindex', _type: 'mytype', _id: 1 } },\r\n     // the document to index\r\n    { title: 'foo' },\r\n    // action description\r\n    { update: { _index: 'myindex', _type: 'mytype', _id: 2 } },\r\n    // the document to update\r\n    { doc: { title: 'foo' } },\r\n    ...\r\n]\r\n```\r\nas is shown in the elasticsearch-js[API Docs](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference-2-2.html#api-bulk-2-2)? \r\n\r\nSo basically I'm trying to omit the action description object, so my body would look like\r\n```\r\n[ \r\n   { data_source_1 },\r\n   { data_source_2 },\r\n   ...\r\n]\r\n```\r\nI don't mind the _id being auto generated (unless that has some negative consequences that I'm not aware of). I thought the bulk method also takes in the index and type in the parameters so it seems redundant to specify those for each document if you're just indexing one type in one index. I guess you do still need the action verb, but it would be nice if you could specify that in the parameters as well.\r\n\r\nI feel like a lot of JSON data out there doesn't have the action description object, and so would have to be added after, which seems like a painful task. What are people doing when they have to index lots of documents at once?"},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch-js/issues/comments/218824506","html_url":"https://github.com/elastic/elasticsearch-js/issues/401#issuecomment-218824506","issue_url":"https://api.github.com/repos/elastic/elasticsearch-js/issues/401","id":218824506,"user":{"login":"samechikson","id":5728532,"avatar_url":"https://avatars.githubusercontent.com/u/5728532?v=3","gravatar_id":"","url":"https://api.github.com/users/samechikson","html_url":"https://github.com/samechikson","followers_url":"https://api.github.com/users/samechikson/followers","following_url":"https://api.github.com/users/samechikson/following{/other_user}","gists_url":"https://api.github.com/users/samechikson/gists{/gist_id}","starred_url":"https://api.github.com/users/samechikson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samechikson/subscriptions","organizations_url":"https://api.github.com/users/samechikson/orgs","repos_url":"https://api.github.com/users/samechikson/repos","events_url":"https://api.github.com/users/samechikson/events{/privacy}","received_events_url":"https://api.github.com/users/samechikson/received_events","type":"User","site_admin":false},"created_at":"2016-05-12T17:16:12Z","updated_at":"2016-05-12T17:16:12Z","body":"Just for reference, created a small utility for myself to bulk index documents without the action description item [here](https://github.com/samechikson/es-json-load). It just inserts `{ index: {} } ` before each entry."}}