Hi,

I have a type whose data looks like this:

{
    "date": "2014-01-01"
    "element": "abc",
    "type": "A"
},
{
    "date": "2014-01-02"
    "element": "abc",
    "type": "B"
},
{
    "date": "2014-01-03"
    "element": "def",
    "type": "A"
}

I'd like to be able to group the data by element, and count the documents 
where the LAST document by date have a type of A. In this case, I want the 
result to be "1" (because the second document, that has the same element as 
the first document, has a date that is after the first document, but as its 
type is not B, I don't want it to be counted ; for the last document, it is 
the only one with element "def" and the type is A).

I'm not sure this is even possible. Please note that the cardinality of 
"element" can be quite high (up to 20 000 different values).

Thank you in advance!

-- 
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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/46509869-4afa-4062-8c34-ad828dcf680c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to