Aggregate two collections on date field

Hello guys, I'm starting using Elasticsearch and I would like to know some things before I deep dive in it.

  1. Is it possible to query two different indexes, and aggregate the data matching a specific date?

  2. If the date format contains the date and the time, can I aggregate it by hour for example?

I know both solutions can be done on mongoDB using aggregations, but I want to start using ES.


holdings: [{
    name: "xpto", 
    quantity: 5,
    date: "2018-05-20 23:30:00"
}, {...}]

prices: [{
    name: "xpto", 
    price: 10000,
    date: "2018-05-20 23:10:00"
}, {...}]

I spect an output like that:

total_value: [{
    name: "xpto", 
    value: 50000,
    date: "2018-05-20 23:00:00"
}, {...}]

Note: I aggregate the data based on the hour.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.