Open bompi88 opened 7 years ago
wow, good stuff! looking forward
Test app is available at https://github.com/bompi88/easy-search-leaderboard. The filters are retrieved from ES aggregations.
@matteodem thanks for quick merging 😄 have you looked at this PR? some things you like me to add or modify?
Can you add a useage example of this aggregations functionality to the elasticsearch README? with the component methods and so on.
Otherwise good job!
done !
still got a comment open, can you have a look at that? otherwise it's fine to merge for me
any progress on this?
@matteodem The progress stalled. I'm not sure where I should precede from here? You want me to extend the core's SearchCollection
, to extract the Elasticsearch specific code?
@bompi88 I think it'd be much cleaner to put the aggregation logic into the ESSearchCollection
and only change the core SearchCollection
as to make this easily possible. Maybe add a onPublish()
method on the class that can be overriden by ESSearchCollection to publish the aggregation data.
Also the cursor.mongoCursor.count
logic in the setInterval might also be changed to be a cursor.cursorCount
method or accessor that can be overridden by the ESCursor, so that there doesn't have to be any "mongCount" and other logic in the core.
This is all with the goal to keep elastic search related logic out of the core code. Hope it makes sense
Implementing Elasticsearch aggregations, which are published together with the hits data.
In current implementation, the aggregations are injected in the
body
function like so:and gets accessible on the cursor returned by the
search
method like this: