distinct_countOn Thu, May 22, 2014 at 10:34 PM, Phil Price <
[email protected]> wrote:
> I would expect (aggregations.has_thing.dictinct_count.value +
> aggregations.does_not_have_thing.distinct_count.value) to be close to
> aggreations.total_distinct_count.value, but in reality it's pretty far off
>
I think this result is to be expected if you have some user IDs that match
both criteria? Eg. if your index has these two documents:
{
"UserId" : 42,
"State": "thing"
}
{
"UserId" : 42,
"State": "anything"
}
Then your aggregations would look like:
"aggregations": {
"total_distinct_count": {
"value": 1
},
"does_not_have_thing": {
"doc_count": 1,
"distinct_count": {
"value": 1
}
},
"has_thing": {
"doc_count": 1,
"distinct_count": {
"value": 1
}
}
}
And the sum of the values of distinct_count per bucket is larger than the
global value for distinct_count.
--
Adrien Grand
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j6Dsf5wbALt4v7ObbeM%3DRyuHDG-ueYoNnXFwzE_TtQqdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.