{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/16433","repository_url":"https://api.github.com/repos/elastic/elasticsearch","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/16433/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/16433/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/16433/events","html_url":"https://github.com/elastic/elasticsearch/pull/16433","id":131212357,"number":16433,"title":"add local cardinality","user":{"login":"yynil","id":3609719,"avatar_url":"https://avatars.githubusercontent.com/u/3609719?v=3","gravatar_id":"","url":"https://api.github.com/users/yynil","html_url":"https://github.com/yynil","followers_url":"https://api.github.com/users/yynil/followers","following_url":"https://api.github.com/users/yynil/following{/other_user}","gists_url":"https://api.github.com/users/yynil/gists{/gist_id}","starred_url":"https://api.github.com/users/yynil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yynil/subscriptions","organizations_url":"https://api.github.com/users/yynil/orgs","repos_url":"https://api.github.com/users/yynil/repos","events_url":"https://api.github.com/users/yynil/events{/privacy}","received_events_url":"https://api.github.com/users/yynil/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-04T01:43:13Z","updated_at":"2016-02-04T01:59:57Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/16433","html_url":"https://github.com/elastic/elasticsearch/pull/16433","diff_url":"https://github.com/elastic/elasticsearch/pull/16433.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/16433.patch"},"body":"if the distinct value is already the routing one, just merge the HLL's results instead of the objects."},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/179572853","html_url":"https://github.com/elastic/elasticsearch/pull/16433#issuecomment-179572853","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/16433","id":179572853,"user":{"login":"yynil","id":3609719,"avatar_url":"https://avatars.githubusercontent.com/u/3609719?v=3","gravatar_id":"","url":"https://api.github.com/users/yynil","html_url":"https://github.com/yynil","followers_url":"https://api.github.com/users/yynil/followers","following_url":"https://api.github.com/users/yynil/following{/other_user}","gists_url":"https://api.github.com/users/yynil/gists{/gist_id}","starred_url":"https://api.github.com/users/yynil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yynil/subscriptions","organizations_url":"https://api.github.com/users/yynil/orgs","repos_url":"https://api.github.com/users/yynil/repos","events_url":"https://api.github.com/users/yynil/events{/privacy}","received_events_url":"https://api.github.com/users/yynil/received_events","type":"User","site_admin":false},"created_at":"2016-02-04T01:59:57Z","updated_at":"2016-02-04T01:59:57Z","body":"For a distinct count metric aggregation, if the distinct value is already the routing one, user_id for an example, the merge node doesn't need to merge all HLL objects. The merge node just needs to merge the result(just a long value) of all distributed HLL objects in all shard nodes. It saves the network and cpu in both the shard nodes and the merge node.\r\nThough it's rare in a lot of distinct aggregation that the distinct value equals the routing value, it's useful for those who already do the tricks. It's especially useful in calculating the unique users in web analytics. "}}