{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/15876","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/15876/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/15876/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/15876/events","html_url":"https://github.com/elastic/elasticsearch/issues/15876","id":125835704,"number":15876,"title":"Support for precise cardinality aggregation","user":{"login":"roytmana","id":2524911,"avatar_url":"https://avatars.githubusercontent.com/u/2524911?v=3","gravatar_id":"","url":"https://api.github.com/users/roytmana","html_url":"https://github.com/roytmana","followers_url":"https://api.github.com/users/roytmana/followers","following_url":"https://api.github.com/users/roytmana/following{/other_user}","gists_url":"https://api.github.com/users/roytmana/gists{/gist_id}","starred_url":"https://api.github.com/users/roytmana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roytmana/subscriptions","organizations_url":"https://api.github.com/users/roytmana/orgs","repos_url":"https://api.github.com/users/roytmana/repos","events_url":"https://api.github.com/users/roytmana/events{/privacy}","received_events_url":"https://api.github.com/users/roytmana/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/:Aggregations","name":":Aggregations","color":"009800"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/feedback_needed","name":"feedback_needed","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-01-10T18:13:53Z","updated_at":"2016-01-11T19:00:43Z","closed_at":null,"body":"While current cardinality aggregation works fast and supports very large datases it is not precise. There are many use cases where approximation is not acceptable and where cardinality is sufficiently low (and known) to allow a simple deterministic algorithms to work and to provide precise result with reasonable time and memory use.\r\n\r\nIt would be very useful if elastic supported a secondary simple algorithm to provide precise cardinality calculation and let users decide which one to use depending on their needs"},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/170653323","html_url":"https://github.com/elastic/elasticsearch/issues/15876#issuecomment-170653323","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/15876","id":170653323,"user":{"login":"roytmana","id":2524911,"avatar_url":"https://avatars.githubusercontent.com/u/2524911?v=3","gravatar_id":"","url":"https://api.github.com/users/roytmana","html_url":"https://github.com/roytmana","followers_url":"https://api.github.com/users/roytmana/followers","following_url":"https://api.github.com/users/roytmana/following{/other_user}","gists_url":"https://api.github.com/users/roytmana/gists{/gist_id}","starred_url":"https://api.github.com/users/roytmana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roytmana/subscriptions","organizations_url":"https://api.github.com/users/roytmana/orgs","repos_url":"https://api.github.com/users/roytmana/repos","events_url":"https://api.github.com/users/roytmana/events{/privacy}","received_events_url":"https://api.github.com/users/roytmana/received_events","type":"User","site_admin":false},"created_at":"2016-01-11T19:00:43Z","updated_at":"2016-01-11T19:00:43Z","body":"@jpountz I understand but would like to make another plea :-) since my customers are rather unhappy abut it  \r\n\r\nElastic does forward shard search results or aggregations to coordinating node for merging why not the unique values? If a user needs precise count and that's the only way to do it, he/she would find the cost in processing/memory/networking acceptable and ensure the cardinality is not out of reasonable range before using this algorithm. As of now there is no way to do it at all no matter at what the cost is.\r\n\r\nEven if you make the existing algorithm more memory efficient, it still does not guarantee exactness even what looks like with thresholds higher than actual cardinality. Is that the correct understanding (it is what I seem to observe anyways)? \r\n\r\n"}}