Could you please comment if the new aggregation module will solve my use case?

Could you please comment if the new aggregation module will solve my use
case?

If I have documents with these values.

_source: {date: 01.01.2013 desc: XXX value: 100}
_source: {date: 02.01.2012 desc: XXX value: 200}
_source: {date: 03.01.2011 desc: XXX value: 300}
_source: {date: 04.01.2011 desc: YYY value: 400}
_source: {date: 05.01.2011 desc: YYY value: 500}

I need to produce:

Desc Last Date Last Value
XXX 01.01.2013 100
YYY 05.01.2011 500

I need to get the documents with the most recent date for that desc so I
can pull the value off of it.
If aggregation can not give me the document would it be possible to give
the document id with the most recent date for that desc? And I could use an
id filter to get the documents.

Thanks for your time.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

It won't do this for you exactly but you can probably get close. An
aggregator like:

terms agg on desc:
stats agg on date:

This should give you min and max date for your top desc values. You could
then use that information to craft a query to get your most recent doc
back: and(desc:XXX, date:01.01.2013). There also might be other
approaches you can do as well. Have you looked into structuring your data
differently? Maybe overwrite/update existing docs with latest date and
value information so you don't have all these duplicates? Maybe use
parent/child or nested documents?

Thanks,
Matt Weber

On Fri, Aug 2, 2013 at 5:16 AM, robertmattler@gmail.com wrote:

Could you please comment if the new aggregation module will solve my use
case?

If I have documents with these values.

_source: {date: 01.01.2013 desc: XXX value: 100}
_source: {date: 02.01.2012 desc: XXX value: 200}
_source: {date: 03.01.2011 desc: XXX value: 300}
_source: {date: 04.01.2011 desc: YYY value: 400}
_source: {date: 05.01.2011 desc: YYY value: 500}

I need to produce:

Desc Last Date Last Value
XXX 01.01.2013 100
YYY 05.01.2011 500

I need to get the documents with the most recent date for that desc so I
can pull the value off of it.
If aggregation can not give me the document would it be possible to give
the document id with the most recent date for that desc? And I could use an
id filter to get the documents.

Thanks for your time.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.