{"action":"created","issue":{"url":"https://api.github.com/repos/logstash-plugins/logstash-output-elasticsearch/issues/356","repository_url":"https://api.github.com/repos/logstash-plugins/logstash-output-elasticsearch","labels_url":"https://api.github.com/repos/logstash-plugins/logstash-output-elasticsearch/issues/356/labels{/name}","comments_url":"https://api.github.com/repos/logstash-plugins/logstash-output-elasticsearch/issues/356/comments","events_url":"https://api.github.com/repos/logstash-plugins/logstash-output-elasticsearch/issues/356/events","html_url":"https://github.com/logstash-plugins/logstash-output-elasticsearch/issues/356","id":131001389,"number":356,"title":"Update action wrong.","user":{"login":"kiryam","id":146705,"avatar_url":"https://avatars.githubusercontent.com/u/146705?v=3","gravatar_id":"","url":"https://api.github.com/users/kiryam","html_url":"https://github.com/kiryam","followers_url":"https://api.github.com/users/kiryam/followers","following_url":"https://api.github.com/users/kiryam/following{/other_user}","gists_url":"https://api.github.com/users/kiryam/gists{/gist_id}","starred_url":"https://api.github.com/users/kiryam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiryam/subscriptions","organizations_url":"https://api.github.com/users/kiryam/orgs","repos_url":"https://api.github.com/users/kiryam/repos","events_url":"https://api.github.com/users/kiryam/events{/privacy}","received_events_url":"https://api.github.com/users/kiryam/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":22,"created_at":"2016-02-03T11:49:00Z","updated_at":"2016-03-02T09:40:06Z","closed_at":"2016-02-24T07:23:30Z","body":"In\r\nlib/logstash/outputs/elasticsearch/http_client.rb\r\n\r\nLine\r\n`source = { 'doc' => source }`\r\n\r\nIt is wrong.\r\nIn documenation\r\nhttps://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html\r\n\r\n\r\nExample:\r\n```\r\n{ \"index\" : { \"_index\" : \"test\", \"_type\" : \"type1\", \"_id\" : \"1\" } }\r\n{ \"field1\" : \"value1\" }\r\n{ \"delete\" : { \"_index\" : \"test\", \"_type\" : \"type1\", \"_id\" : \"2\" } }\r\n{ \"create\" : { \"_index\" : \"test\", \"_type\" : \"type1\", \"_id\" : \"3\" } }\r\n{ \"field1\" : \"value3\" }\r\n{ \"update\" : {\"_id\" : \"1\", \"_type\" : \"type1\", \"_index\" : \"test\"} }\r\n{ \"doc\" : {\"field2\" : \"value2\"}}\r\n\r\n```\r\n\r\nIf I push code bellow, I will have in ES like this:\r\n```\r\ncurl -XPOST http://localhost:9200/test/_search?pretty\r\n{\r\n  \"took\" : 1,\r\n  \"timed_out\" : false,\r\n  \"_shards\" : {\r\n    \"total\" : 5,\r\n    \"successful\" : 5,\r\n    \"failed\" : 0\r\n  },\r\n  \"hits\" : {\r\n    \"total\" : 2,\r\n    \"max_score\" : 1.0,\r\n    \"hits\" : [ {\r\n      \"_index\" : \"test\",\r\n      \"_type\" : \"type1\",\r\n      \"_id\" : \"1\",\r\n      \"_score\" : 1.0,\r\n      \"_source\" : {\r\n        \"field1\" : \"value1\",\r\n        \"@version\" : \"1\",\r\n        \"@timestamp\" : \"2016-02-03T11:46:12.337Z\",\r\n        \"doc\" : {\r\n          \"field2\" : \"value2\"\r\n        }\r\n      }\r\n    }, {\r\n      \"_index\" : \"test\",\r\n      \"_type\" : \"type1\",\r\n      \"_id\" : \"3\",\r\n      \"_score\" : 1.0,\r\n      \"_source\" : {\r\n        \"field1\" : \"value3\",\r\n        \"@version\" : \"1\",\r\n        \"@timestamp\" : \"2016-02-03T11:46:12.337Z\"\r\n      }\r\n    } ]\r\n  }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/logstash-plugins/logstash-output-elasticsearch/issues/comments/191157085","html_url":"https://github.com/logstash-plugins/logstash-output-elasticsearch/issues/356#issuecomment-191157085","issue_url":"https://api.github.com/repos/logstash-plugins/logstash-output-elasticsearch/issues/356","id":191157085,"user":{"login":"kiryam","id":146705,"avatar_url":"https://avatars.githubusercontent.com/u/146705?v=3","gravatar_id":"","url":"https://api.github.com/users/kiryam","html_url":"https://github.com/kiryam","followers_url":"https://api.github.com/users/kiryam/followers","following_url":"https://api.github.com/users/kiryam/following{/other_user}","gists_url":"https://api.github.com/users/kiryam/gists{/gist_id}","starred_url":"https://api.github.com/users/kiryam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiryam/subscriptions","organizations_url":"https://api.github.com/users/kiryam/orgs","repos_url":"https://api.github.com/users/kiryam/repos","events_url":"https://api.github.com/users/kiryam/events{/privacy}","received_events_url":"https://api.github.com/users/kiryam/received_events","type":"User","site_admin":false},"created_at":"2016-03-02T09:40:06Z","updated_at":"2016-03-02T09:40:06Z","body":"@bk1te elasticsearch_output add doc field to event data. Es_bulk codec generate event as is. With doc field, but it should delete doc field first."}}