{"action":"closed","number":322,"pull_request":{"url":"https://api.github.com/repos/moneyadviceservice/rad/pulls/322","id":49040476,"html_url":"https://github.com/moneyadviceservice/rad/pull/322","diff_url":"https://github.com/moneyadviceservice/rad/pull/322.diff","patch_url":"https://github.com/moneyadviceservice/rad/pull/322.patch","issue_url":"https://api.github.com/repos/moneyadviceservice/rad/issues/322","number":322,"state":"closed","locked":false,"title":"Create a rake report to audit the index against the database","user":{"login":"munckymagik","id":306583,"avatar_url":"https://avatars.githubusercontent.com/u/306583?v=3","gravatar_id":"","url":"https://api.github.com/users/munckymagik","html_url":"https://github.com/munckymagik","followers_url":"https://api.github.com/users/munckymagik/followers","following_url":"https://api.github.com/users/munckymagik/following{/other_user}","gists_url":"https://api.github.com/users/munckymagik/gists{/gist_id}","starred_url":"https://api.github.com/users/munckymagik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/munckymagik/subscriptions","organizations_url":"https://api.github.com/users/munckymagik/orgs","repos_url":"https://api.github.com/users/munckymagik/repos","events_url":"https://api.github.com/users/munckymagik/events{/privacy}","received_events_url":"https://api.github.com/users/munckymagik/received_events","type":"User","site_admin":false},"body":"We need to reindex the entire contents of our ElasticSearch index. When we did looked at doing this on the demo server we noticed there were 10 more records in the index than in the database. Not hugely surprising, but we need to work out what is happening here.\r\n\r\nThis rake task and helper class allow us to work out what's going on.\r\n\r\n# Example of the Rake output\r\n\r\n```\r\n$ heroku run rake reports:audit_index_csv\r\nRunning rake reports:audit_index_csv on mas-rad-demo... up, run.2499\r\nid,frn,name,exists_in_es?,exists_in_db?,publishable?,geocoded?,action\r\n2,,,true,false,,,delete_from_es\r\n4,,,true,false,,,delete_from_es\r\n5,,,true,false,,,delete_from_es\r\n7,,,true,false,,,delete_from_es\r\n8,,,true,false,,,delete_from_es\r\n9,,,true,false,,,delete_from_es\r\n12,,,true,false,,,delete_from_es\r\n40,503220,Redacted Firm Name,false,true,false,true,do_nothing\r\n45,439620,Redacted Firm Name,false,true,false,true,do_nothing\r\n62,501806,Redacted Firm Name,false,true,false,true,do_nothing\r\n71,194713,Redacted Firm Name,false,true,false,true,do_nothing\r\n74,607322,Redacted Firm Name,false,true,false,true,do_nothing\r\n76,194713,Redacted Firm Name,false,true,false,true,do_nothing\r\n109,153420,Redacted Firm Name,false,true,false,true,do_nothing\r\n\r\n...\r\n```\r\n\r\n# Example console output using the helper class\r\n\r\n```\r\nirb(main):001:0> ai = Tasks::AuditIndex.new\r\n=> #<Tasks::AuditIndex:0x007fd7bd2778f0>\r\nirb(main):002:0> ai.all_es_firm_ids.count\r\n=> 2494\r\nirb(main):003:0> ai.all_pg_firm_ids.count\r\n=> 2780\r\nirb(main):004:0> ai.in_es_not_pg\r\n=> [2, 4, 5, 7, 8, 9, 12]\r\n```","created_at":"2015-10-28T17:34:42Z","updated_at":"2015-10-29T15:02:27Z","closed_at":"2015-10-29T15:02:27Z","merged_at":"2015-10-29T15:02:27Z","merge_commit_sha":"56bae0875d0107491c50a8e297ecbbf2cb3cddfc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/moneyadviceservice/rad/pulls/322/commits","review_comments_url":"https://api.github.com/repos/moneyadviceservice/rad/pulls/322/comments","review_comment_url":"https://api.github.com/repos/moneyadviceservice/rad/pulls/comments{/number}","comments_url":"https://api.github.com/repos/moneyadviceservice/rad/issues/322/comments","statuses_url":"https://api.github.com/repos/moneyadviceservice/rad/statuses/4c466f068f5dd2a7bb4f673aad5afc0c22561d7d","head":{"label":"moneyadviceservice:audit_index","ref":"audit_index","sha":"4c466f068f5dd2a7bb4f673aad5afc0c22561d7d","user":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"repo":{"id":26871523,"name":"rad","full_name":"moneyadviceservice/rad","owner":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/moneyadviceservice/rad","description":"Retirement Adviser Directory","fork":false,"url":"https://api.github.com/repos/moneyadviceservice/rad","forks_url":"https://api.github.com/repos/moneyadviceservice/rad/forks","keys_url":"https://api.github.com/repos/moneyadviceservice/rad/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moneyadviceservice/rad/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moneyadviceservice/rad/teams","hooks_url":"https://api.github.com/repos/moneyadviceservice/rad/hooks","issue_events_url":"https://api.github.com/repos/moneyadviceservice/rad/issues/events{/number}","events_url":"https://api.github.com/repos/moneyadviceservice/rad/events","assignees_url":"https://api.github.com/repos/moneyadviceservice/rad/assignees{/user}","branches_url":"https://api.github.com/repos/moneyadviceservice/rad/branches{/branch}","tags_url":"https://api.github.com/repos/moneyadviceservice/rad/tags","blobs_url":"https://api.github.com/repos/moneyadviceservice/rad/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moneyadviceservice/rad/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moneyadviceservice/rad/git/refs{/sha}","trees_url":"https://api.github.com/repos/moneyadviceservice/rad/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moneyadviceservice/rad/statuses/{sha}","languages_url":"https://api.github.com/repos/moneyadviceservice/rad/languages","stargazers_url":"https://api.github.com/repos/moneyadviceservice/rad/stargazers","contributors_url":"https://api.github.com/repos/moneyadviceservice/rad/contributors","subscribers_url":"https://api.github.com/repos/moneyadviceservice/rad/subscribers","subscription_url":"https://api.github.com/repos/moneyadviceservice/rad/subscription","commits_url":"https://api.github.com/repos/moneyadviceservice/rad/commits{/sha}","git_commits_url":"https://api.github.com/repos/moneyadviceservice/rad/git/commits{/sha}","comments_url":"https://api.github.com/repos/moneyadviceservice/rad/comments{/number}","issue_comment_url":"https://api.github.com/repos/moneyadviceservice/rad/issues/comments{/number}","contents_url":"https://api.github.com/repos/moneyadviceservice/rad/contents/{+path}","compare_url":"https://api.github.com/repos/moneyadviceservice/rad/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moneyadviceservice/rad/merges","archive_url":"https://api.github.com/repos/moneyadviceservice/rad/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moneyadviceservice/rad/downloads","issues_url":"https://api.github.com/repos/moneyadviceservice/rad/issues{/number}","pulls_url":"https://api.github.com/repos/moneyadviceservice/rad/pulls{/number}","milestones_url":"https://api.github.com/repos/moneyadviceservice/rad/milestones{/number}","notifications_url":"https://api.github.com/repos/moneyadviceservice/rad/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moneyadviceservice/rad/labels{/name}","releases_url":"https://api.github.com/repos/moneyadviceservice/rad/releases{/id}","created_at":"2014-11-19T16:55:48Z","updated_at":"2015-06-15T15:36:58Z","pushed_at":"2015-10-29T15:02:27Z","git_url":"git://github.com/moneyadviceservice/rad.git","ssh_url":"git@github.com:moneyadviceservice/rad.git","clone_url":"https://github.com/moneyadviceservice/rad.git","svn_url":"https://github.com/moneyadviceservice/rad","homepage":"","size":6209,"stargazers_count":1,"watchers_count":1,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"moneyadviceservice:master","ref":"master","sha":"721c1156fcf3f6308b2fe4a0f4336d7f906489a9","user":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"repo":{"id":26871523,"name":"rad","full_name":"moneyadviceservice/rad","owner":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/moneyadviceservice/rad","description":"Retirement Adviser Directory","fork":false,"url":"https://api.github.com/repos/moneyadviceservice/rad","forks_url":"https://api.github.com/repos/moneyadviceservice/rad/forks","keys_url":"https://api.github.com/repos/moneyadviceservice/rad/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moneyadviceservice/rad/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moneyadviceservice/rad/teams","hooks_url":"https://api.github.com/repos/moneyadviceservice/rad/hooks","issue_events_url":"https://api.github.com/repos/moneyadviceservice/rad/issues/events{/number}","events_url":"https://api.github.com/repos/moneyadviceservice/rad/events","assignees_url":"https://api.github.com/repos/moneyadviceservice/rad/assignees{/user}","branches_url":"https://api.github.com/repos/moneyadviceservice/rad/branches{/branch}","tags_url":"https://api.github.com/repos/moneyadviceservice/rad/tags","blobs_url":"https://api.github.com/repos/moneyadviceservice/rad/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moneyadviceservice/rad/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moneyadviceservice/rad/git/refs{/sha}","trees_url":"https://api.github.com/repos/moneyadviceservice/rad/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moneyadviceservice/rad/statuses/{sha}","languages_url":"https://api.github.com/repos/moneyadviceservice/rad/languages","stargazers_url":"https://api.github.com/repos/moneyadviceservice/rad/stargazers","contributors_url":"https://api.github.com/repos/moneyadviceservice/rad/contributors","subscribers_url":"https://api.github.com/repos/moneyadviceservice/rad/subscribers","subscription_url":"https://api.github.com/repos/moneyadviceservice/rad/subscription","commits_url":"https://api.github.com/repos/moneyadviceservice/rad/commits{/sha}","git_commits_url":"https://api.github.com/repos/moneyadviceservice/rad/git/commits{/sha}","comments_url":"https://api.github.com/repos/moneyadviceservice/rad/comments{/number}","issue_comment_url":"https://api.github.com/repos/moneyadviceservice/rad/issues/comments{/number}","contents_url":"https://api.github.com/repos/moneyadviceservice/rad/contents/{+path}","compare_url":"https://api.github.com/repos/moneyadviceservice/rad/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moneyadviceservice/rad/merges","archive_url":"https://api.github.com/repos/moneyadviceservice/rad/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moneyadviceservice/rad/downloads","issues_url":"https://api.github.com/repos/moneyadviceservice/rad/issues{/number}","pulls_url":"https://api.github.com/repos/moneyadviceservice/rad/pulls{/number}","milestones_url":"https://api.github.com/repos/moneyadviceservice/rad/milestones{/number}","notifications_url":"https://api.github.com/repos/moneyadviceservice/rad/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moneyadviceservice/rad/labels{/name}","releases_url":"https://api.github.com/repos/moneyadviceservice/rad/releases{/id}","created_at":"2014-11-19T16:55:48Z","updated_at":"2015-06-15T15:36:58Z","pushed_at":"2015-10-29T15:02:27Z","git_url":"git://github.com/moneyadviceservice/rad.git","ssh_url":"git@github.com:moneyadviceservice/rad.git","clone_url":"https://github.com/moneyadviceservice/rad.git","svn_url":"https://github.com/moneyadviceservice/rad","homepage":"","size":6209,"stargazers_count":1,"watchers_count":1,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/moneyadviceservice/rad/pulls/322"},"html":{"href":"https://github.com/moneyadviceservice/rad/pull/322"},"issue":{"href":"https://api.github.com/repos/moneyadviceservice/rad/issues/322"},"comments":{"href":"https://api.github.com/repos/moneyadviceservice/rad/issues/322/comments"},"review_comments":{"href":"https://api.github.com/repos/moneyadviceservice/rad/pulls/322/comments"},"review_comment":{"href":"https://api.github.com/repos/moneyadviceservice/rad/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/moneyadviceservice/rad/pulls/322/commits"},"statuses":{"href":"https://api.github.com/repos/moneyadviceservice/rad/statuses/4c466f068f5dd2a7bb4f673aad5afc0c22561d7d"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"munckymagik","id":306583,"avatar_url":"https://avatars.githubusercontent.com/u/306583?v=3","gravatar_id":"","url":"https://api.github.com/users/munckymagik","html_url":"https://github.com/munckymagik","followers_url":"https://api.github.com/users/munckymagik/followers","following_url":"https://api.github.com/users/munckymagik/following{/other_user}","gists_url":"https://api.github.com/users/munckymagik/gists{/gist_id}","starred_url":"https://api.github.com/users/munckymagik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/munckymagik/subscriptions","organizations_url":"https://api.github.com/users/munckymagik/orgs","repos_url":"https://api.github.com/users/munckymagik/repos","events_url":"https://api.github.com/users/munckymagik/events{/privacy}","received_events_url":"https://api.github.com/users/munckymagik/received_events","type":"User","site_admin":false},"comments":3,"review_comments":5,"commits":1,"additions":142,"deletions":0,"changed_files":2}}