{"action":"created","comment":{"url":"https://api.github.com/repos/inspirehep/inspire-next/pulls/comments/64542883","id":64542883,"diff_hunk":"@@ -42,24 +45,35 @@ def references(self):\n             refs_to_get_from_es = [\n                 ref['recid'] for ref in references if ref.get('recid')\n             ]\n-            records_from_es = []\n-\n-            if refs_to_get_from_es:\n-                records_from_es = es.mget(body={\n-                    \"ids\": refs_to_get_from_es\n-                }, index=\"records-hep\")['docs']\n+            query = IQ(' OR '.join('recid:' + str(ref)\n+                                   for ref in refs_to_get_from_es))\n+            records_from_es = current_search_client.search(\n+                index='records-hep',\n+                doc_type='hep',\n+                body={\"query\": query.to_dict()},\n+                size=9999,\n+                _source=[\n+                    'control_number',\n+                    'citation_count',\n+                    'titles',\n+                    'earliest_date',\n+                    'authors',\n+                    'collaboration',\n+                    'corporate_author',\n+                    'publication_info'\n+                ]\n+            )['hits']['hits']\n \n             refs_from_es = {\n-                ref['_id']: ref['_source'] for ref in records_from_es if '_source' in ref\n+                ref['_source']['control_number']: ref['_source'] for ref in records_from_es\n             }\n             for reference in references:\n                 row = []\n                 recid = reference.get('recid')\n                 ref_record = refs_from_es.get(str(recid)) if recid else None","path":"inspirehep/utils/references.py","position":52,"original_position":52,"commit_id":"510af8a3cc674f97b2bba57582efb8f5319dede9","original_commit_id":"510af8a3cc674f97b2bba57582efb8f5319dede9","user":{"login":"mihaibivol","id":490125,"avatar_url":"https://avatars.githubusercontent.com/u/490125?v=3","gravatar_id":"","url":"https://api.github.com/users/mihaibivol","html_url":"https://github.com/mihaibivol","followers_url":"https://api.github.com/users/mihaibivol/followers","following_url":"https://api.github.com/users/mihaibivol/following{/other_user}","gists_url":"https://api.github.com/users/mihaibivol/gists{/gist_id}","starred_url":"https://api.github.com/users/mihaibivol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mihaibivol/subscriptions","organizations_url":"https://api.github.com/users/mihaibivol/orgs","repos_url":"https://api.github.com/users/mihaibivol/repos","events_url":"https://api.github.com/users/mihaibivol/events{/privacy}","received_events_url":"https://api.github.com/users/mihaibivol/received_events","type":"User","site_admin":false},"body":"Is this always a string in the mapping? I think it would be more future-proof to to `str(ref['_source']['control_number'])` in the dict comprehension.","created_at":"2016-05-25T09:34:47Z","updated_at":"2016-05-25T09:34:47Z","html_url":"https://github.com/inspirehep/inspire-next/pull/1142#discussion_r64542883","pull_request_url":"https://api.github.com/repos/inspirehep/inspire-next/pulls/1142","_links":{"self":{"href":"https://api.github.com/repos/inspirehep/inspire-next/pulls/comments/64542883"},"html":{"href":"https://github.com/inspirehep/inspire-next/pull/1142#discussion_r64542883"},"pull_request":{"href":"https://api.github.com/repos/inspirehep/inspire-next/pulls/1142"}}},"pull_request":{"url":"https://api.github.com/repos/inspirehep/inspire-next/pulls/1142","id":71201557,"html_url":"https://github.com/inspirehep/inspire-next/pull/1142","diff_url":"https://github.com/inspirehep/inspire-next/pull/1142.diff","patch_url":"https://github.com/inspirehep/inspire-next/pull/1142.patch","issue_url":"https://api.github.com/repos/inspirehep/inspire-next/issues/1142","number":1142,"state":"open","locked":false,"title":"records: ElasticSearch record class","user":{"login":"jmartinm","id":580727,"avatar_url":"https://avatars.githubusercontent.com/u/580727?v=3","gravatar_id":"","url":"https://api.github.com/users/jmartinm","html_url":"https://github.com/jmartinm","followers_url":"https://api.github.com/users/jmartinm/followers","following_url":"https://api.github.com/users/jmartinm/following{/other_user}","gists_url":"https://api.github.com/users/jmartinm/gists{/gist_id}","starred_url":"https://api.github.com/users/jmartinm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmartinm/subscriptions","organizations_url":"https://api.github.com/users/jmartinm/orgs","repos_url":"https://api.github.com/users/jmartinm/repos","events_url":"https://api.github.com/users/jmartinm/events{/privacy}","received_events_url":"https://api.github.com/users/jmartinm/received_events","type":"User","site_admin":false},"body":"* Adds new Record subclass that gets records from ES instead of DB.\r\n  (closes #1038) (closes #1127)\r\n\r\n* Amends impactgraph_serializer to correctly fetch references.\r\n\r\nSigned-off-by: Javier Martin Montull <javier.martin.montull@cern.ch>","created_at":"2016-05-24T11:15:42Z","updated_at":"2016-05-25T09:34:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"237d12b4a63aae6f974ab614803221ea0d7f0d94","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/inspirehep/inspire-next/pulls/1142/commits","review_comments_url":"https://api.github.com/repos/inspirehep/inspire-next/pulls/1142/comments","review_comment_url":"https://api.github.com/repos/inspirehep/inspire-next/pulls/comments{/number}","comments_url":"https://api.github.com/repos/inspirehep/inspire-next/issues/1142/comments","statuses_url":"https://api.github.com/repos/inspirehep/inspire-next/statuses/510af8a3cc674f97b2bba57582efb8f5319dede9","head":{"label":"jmartinm:fix/impact-graph-references","ref":"fix/impact-graph-references","sha":"510af8a3cc674f97b2bba57582efb8f5319dede9","user":{"login":"jmartinm","id":580727,"avatar_url":"https://avatars.githubusercontent.com/u/580727?v=3","gravatar_id":"","url":"https://api.github.com/users/jmartinm","html_url":"https://github.com/jmartinm","followers_url":"https://api.github.com/users/jmartinm/followers","following_url":"https://api.github.com/users/jmartinm/following{/other_user}","gists_url":"https://api.github.com/users/jmartinm/gists{/gist_id}","starred_url":"https://api.github.com/users/jmartinm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmartinm/subscriptions","organizations_url":"https://api.github.com/users/jmartinm/orgs","repos_url":"https://api.github.com/users/jmartinm/repos","events_url":"https://api.github.com/users/jmartinm/events{/privacy}","received_events_url":"https://api.github.com/users/jmartinm/received_events","type":"User","site_admin":false},"repo":{"id":16168487,"name":"inspire-next","full_name":"jmartinm/inspire-next","owner":{"login":"jmartinm","id":580727,"avatar_url":"https://avatars.githubusercontent.com/u/580727?v=3","gravatar_id":"","url":"https://api.github.com/users/jmartinm","html_url":"https://github.com/jmartinm","followers_url":"https://api.github.com/users/jmartinm/followers","following_url":"https://api.github.com/users/jmartinm/following{/other_user}","gists_url":"https://api.github.com/users/jmartinm/gists{/gist_id}","starred_url":"https://api.github.com/users/jmartinm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmartinm/subscriptions","organizations_url":"https://api.github.com/users/jmartinm/orgs","repos_url":"https://api.github.com/users/jmartinm/repos","events_url":"https://api.github.com/users/jmartinm/events{/privacy}","received_events_url":"https://api.github.com/users/jmartinm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jmartinm/inspire-next","description":"INSPIRE overlay repository to be used with Invenio's NEXT branch","fork":true,"url":"https://api.github.com/repos/jmartinm/inspire-next","forks_url":"https://api.github.com/repos/jmartinm/inspire-next/forks","keys_url":"https://api.github.com/repos/jmartinm/inspire-next/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jmartinm/inspire-next/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jmartinm/inspire-next/teams","hooks_url":"https://api.github.com/repos/jmartinm/inspire-next/hooks","issue_events_url":"https://api.github.com/repos/jmartinm/inspire-next/issues/events{/number}","events_url":"https://api.github.com/repos/jmartinm/inspire-next/events","assignees_url":"https://api.github.com/repos/jmartinm/inspire-next/assignees{/user}","branches_url":"https://api.github.com/repos/jmartinm/inspire-next/branches{/branch}","tags_url":"https://api.github.com/repos/jmartinm/inspire-next/tags","blobs_url":"https://api.github.com/repos/jmartinm/inspire-next/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jmartinm/inspire-next/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jmartinm/inspire-next/git/refs{/sha}","trees_url":"https://api.github.com/repos/jmartinm/inspire-next/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jmartinm/inspire-next/statuses/{sha}","languages_url":"https://api.github.com/repos/jmartinm/inspire-next/languages","stargazers_url":"https://api.github.com/repos/jmartinm/inspire-next/stargazers","contributors_url":"https://api.github.com/repos/jmartinm/inspire-next/contributors","subscribers_url":"https://api.github.com/repos/jmartinm/inspire-next/subscribers","subscription_url":"https://api.github.com/repos/jmartinm/inspire-next/subscription","commits_url":"https://api.github.com/repos/jmartinm/inspire-next/commits{/sha}","git_commits_url":"https://api.github.com/repos/jmartinm/inspire-next/git/commits{/sha}","comments_url":"https://api.github.com/repos/jmartinm/inspire-next/comments{/number}","issue_comment_url":"https://api.github.com/repos/jmartinm/inspire-next/issues/comments{/number}","contents_url":"https://api.github.com/repos/jmartinm/inspire-next/contents/{+path}","compare_url":"https://api.github.com/repos/jmartinm/inspire-next/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jmartinm/inspire-next/merges","archive_url":"https://api.github.com/repos/jmartinm/inspire-next/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jmartinm/inspire-next/downloads","issues_url":"https://api.github.com/repos/jmartinm/inspire-next/issues{/number}","pulls_url":"https://api.github.com/repos/jmartinm/inspire-next/pulls{/number}","milestones_url":"https://api.github.com/repos/jmartinm/inspire-next/milestones{/number}","notifications_url":"https://api.github.com/repos/jmartinm/inspire-next/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jmartinm/inspire-next/labels{/name}","releases_url":"https://api.github.com/repos/jmartinm/inspire-next/releases{/id}","deployments_url":"https://api.github.com/repos/jmartinm/inspire-next/deployments","created_at":"2014-01-23T09:50:18Z","updated_at":"2015-11-06T15:44:49Z","pushed_at":"2016-05-25T08:30:52Z","git_url":"git://github.com/jmartinm/inspire-next.git","ssh_url":"git@github.com:jmartinm/inspire-next.git","clone_url":"https://github.com/jmartinm/inspire-next.git","svn_url":"https://github.com/jmartinm/inspire-next","homepage":null,"size":59570,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"inspirehep:master","ref":"master","sha":"4de8910fff569fc9028300c70b63200da521ddb9","user":{"login":"inspirehep","id":356664,"avatar_url":"https://avatars.githubusercontent.com/u/356664?v=3","gravatar_id":"","url":"https://api.github.com/users/inspirehep","html_url":"https://github.com/inspirehep","followers_url":"https://api.github.com/users/inspirehep/followers","following_url":"https://api.github.com/users/inspirehep/following{/other_user}","gists_url":"https://api.github.com/users/inspirehep/gists{/gist_id}","starred_url":"https://api.github.com/users/inspirehep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inspirehep/subscriptions","organizations_url":"https://api.github.com/users/inspirehep/orgs","repos_url":"https://api.github.com/users/inspirehep/repos","events_url":"https://api.github.com/users/inspirehep/events{/privacy}","received_events_url":"https://api.github.com/users/inspirehep/received_events","type":"Organization","site_admin":false},"repo":{"id":15221515,"name":"inspire-next","full_name":"inspirehep/inspire-next","owner":{"login":"inspirehep","id":356664,"avatar_url":"https://avatars.githubusercontent.com/u/356664?v=3","gravatar_id":"","url":"https://api.github.com/users/inspirehep","html_url":"https://github.com/inspirehep","followers_url":"https://api.github.com/users/inspirehep/followers","following_url":"https://api.github.com/users/inspirehep/following{/other_user}","gists_url":"https://api.github.com/users/inspirehep/gists{/gist_id}","starred_url":"https://api.github.com/users/inspirehep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inspirehep/subscriptions","organizations_url":"https://api.github.com/users/inspirehep/orgs","repos_url":"https://api.github.com/users/inspirehep/repos","events_url":"https://api.github.com/users/inspirehep/events{/privacy}","received_events_url":"https://api.github.com/users/inspirehep/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/inspirehep/inspire-next","description":"INSPIRE overlay repository to be used with https://github.com/inspirehep/invenio@labs branch","fork":false,"url":"https://api.github.com/repos/inspirehep/inspire-next","forks_url":"https://api.github.com/repos/inspirehep/inspire-next/forks","keys_url":"https://api.github.com/repos/inspirehep/inspire-next/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inspirehep/inspire-next/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inspirehep/inspire-next/teams","hooks_url":"https://api.github.com/repos/inspirehep/inspire-next/hooks","issue_events_url":"https://api.github.com/repos/inspirehep/inspire-next/issues/events{/number}","events_url":"https://api.github.com/repos/inspirehep/inspire-next/events","assignees_url":"https://api.github.com/repos/inspirehep/inspire-next/assignees{/user}","branches_url":"https://api.github.com/repos/inspirehep/inspire-next/branches{/branch}","tags_url":"https://api.github.com/repos/inspirehep/inspire-next/tags","blobs_url":"https://api.github.com/repos/inspirehep/inspire-next/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inspirehep/inspire-next/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inspirehep/inspire-next/git/refs{/sha}","trees_url":"https://api.github.com/repos/inspirehep/inspire-next/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inspirehep/inspire-next/statuses/{sha}","languages_url":"https://api.github.com/repos/inspirehep/inspire-next/languages","stargazers_url":"https://api.github.com/repos/inspirehep/inspire-next/stargazers","contributors_url":"https://api.github.com/repos/inspirehep/inspire-next/contributors","subscribers_url":"https://api.github.com/repos/inspirehep/inspire-next/subscribers","subscription_url":"https://api.github.com/repos/inspirehep/inspire-next/subscription","commits_url":"https://api.github.com/repos/inspirehep/inspire-next/commits{/sha}","git_commits_url":"https://api.github.com/repos/inspirehep/inspire-next/git/commits{/sha}","comments_url":"https://api.github.com/repos/inspirehep/inspire-next/comments{/number}","issue_comment_url":"https://api.github.com/repos/inspirehep/inspire-next/issues/comments{/number}","contents_url":"https://api.github.com/repos/inspirehep/inspire-next/contents/{+path}","compare_url":"https://api.github.com/repos/inspirehep/inspire-next/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inspirehep/inspire-next/merges","archive_url":"https://api.github.com/repos/inspirehep/inspire-next/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inspirehep/inspire-next/downloads","issues_url":"https://api.github.com/repos/inspirehep/inspire-next/issues{/number}","pulls_url":"https://api.github.com/repos/inspirehep/inspire-next/pulls{/number}","milestones_url":"https://api.github.com/repos/inspirehep/inspire-next/milestones{/number}","notifications_url":"https://api.github.com/repos/inspirehep/inspire-next/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inspirehep/inspire-next/labels{/name}","releases_url":"https://api.github.com/repos/inspirehep/inspire-next/releases{/id}","deployments_url":"https://api.github.com/repos/inspirehep/inspire-next/deployments","created_at":"2013-12-16T09:11:58Z","updated_at":"2016-05-17T13:36:56Z","pushed_at":"2016-05-25T09:17:32Z","git_url":"git://github.com/inspirehep/inspire-next.git","ssh_url":"git@github.com:inspirehep/inspire-next.git","clone_url":"https://github.com/inspirehep/inspire-next.git","svn_url":"https://github.com/inspirehep/inspire-next","homepage":"https://labs.inspirehep.net","size":63899,"stargazers_count":13,"watchers_count":13,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":125,"forks":29,"open_issues":125,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/inspirehep/inspire-next/pulls/1142"},"html":{"href":"https://github.com/inspirehep/inspire-next/pull/1142"},"issue":{"href":"https://api.github.com/repos/inspirehep/inspire-next/issues/1142"},"comments":{"href":"https://api.github.com/repos/inspirehep/inspire-next/issues/1142/comments"},"review_comments":{"href":"https://api.github.com/repos/inspirehep/inspire-next/pulls/1142/comments"},"review_comment":{"href":"https://api.github.com/repos/inspirehep/inspire-next/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/inspirehep/inspire-next/pulls/1142/commits"},"statuses":{"href":"https://api.github.com/repos/inspirehep/inspire-next/statuses/510af8a3cc674f97b2bba57582efb8f5319dede9"}}}}
{"actor":{"display_login":"mihaibivol"}}