Uncommonly common recommendation based on page view stats

Hi,
My question is reference to the example given in following post on significant terms use case
https://www.elastic.co/guide/en/elasticsearch/guide/current/_significant_terms_demo.html#_recommending_based_on_statistics

I have similar requirement, but it is about events instead of movies. So to answer "People who saw this event page have also saw these other events" (based on page views)

So far so good. Now, the problem is that I index the data little differently.
I have an index to store each page view as separate document which also contains all the data about event and user who saw the page

So, every time some user views an event page, I store following field
page_view_id
page_view_timestamp
event_id
event_name
user_id
user_name
...
....

Now, I would like to recommend "People who saw this event page also viewed these events" using significant terms aggregation. But in my case I have to first get list of users who viewed the current event page, and then do another query for finding other events (but uncommonly common) viewed by all those users.
Is there a way to do that in a single query ?
Moreover, the list of users returned from first query could be in thousands. So doing a second query with filter of that many user ids would again be very.

How should I approach this ?

Thank you

Behavioural analysis is most easily attempted on an entity-centric index rather than the sort of event-centric index in your example (which looks typical of most logging applications).

See [1] for background on the approach and the example data/scripts [2]

In your case the entity is identified by the user_id and each user doc should hold an array of things viewed which are not movies but event_id numbers mapped as the keyword type.

[1] https://www.youtube.com/watch?v=yBf7oeJKH2Y
[2] https://www.dropbox.com/s/npnopvcdobpprdw/EntityCentricDemo6.3.zip

Thanks Mark,
I'll go with the approach as suggested by you.

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