ger icon indicating copy to clipboard operation
ger copied to clipboard

easy way to find_events that aren't expired?

Open joshbedo opened this issue 9 years ago • 2 comments

I was looking through the find_events method to check out how it handles expiries and their wasn't an obvious way to pull in all events that haven't expired. Does this exist? something i overlooked?

joshbedo avatar Feb 14 '16 12:02 joshbedo

The find_events method should not return expired events, and in the options object you can pass size and page to scroll through the events. Also you can pass a current_datetime object or string that can 'lock' a query to a specific time, so that inserting new data doesnt screw with your paging.

One of my initial assumptions was that there would be millions of events that haven't expired, so I didnt really see the need to pull all unexpired events. What do you need the functionality for?

grahamjenson avatar Feb 14 '16 18:02 grahamjenson

Awesome that helps, i was thinking I needed to configure something for expiries. I have a getRecommendations method that does the following but I thought i needed to configure it to pull in the non-expired events. Thanks!

  1. find previous non-expired events for the current user id
  2. do events.map((ev) => ev.thing) to get the user ids
  3. Search for users in elasticsearch based on user preferences and exclude users with the previous list of ids

Definitely going to check out the pagination, I'll probably need that later on.

joshbedo avatar Feb 14 '16 20:02 joshbedo