Questions tagged [aggregation]

Aggregation is a relationship between two classes that is best described as a "has-a" and "whole/part" relationship.

Aggregation is a relationship between two classes that is best described as a "has-a" and "whole/part" relationship. It is a more specialized version of the association relationship. The aggregate class contains a reference to another class and is said to have ownership of that class. Each class referenced is considered to be part-of the aggregate class

3383 questions
18
votes
2 answers

When to use association, aggregation, composition and inheritance?

I've seen plenty of posts on Stackoverflow explaining the difference between the relationships: associations, aggregation, composition and inheritance, with examples. However, I'm more specifically confused more about the pros and cons of each of…
18
votes
3 answers

Limit ElasticSearch aggregation to top n query results

I have a set of 2.8 million docs with sets of tags that I'm querying with ElasticSearch, but many of these docs can be grouped together by one ID. I want to query my data using the tags, and then aggregate them by the ID that repeats. Often my…
Patrick Pan
  • 213
  • 4
  • 8
17
votes
1 answer

Elasticsearch aggregation order by top hit score

I want to order buckets by doc.score of top_hit. My current implementation is below. group_by_iid: { terms: { field: 'iid', order: { max_score: 'desc' }, size: 0 }, aggs: { max_score: { max: { script:…
pandora2000
  • 463
  • 1
  • 4
  • 12
17
votes
8 answers

How to aggregate analytics from Google, Twitter, YouTube, Facebook, etc

I have a video blog for which I would like to track certain statistics, including stats from Google Analytics, Twitter, YouTube, Facebook, etc. The problem is that the various stats are on different websites, which require different logins, etc. It…
user245587
16
votes
3 answers

Git diff on topic branch, excluding merge commits that happened in the meantime?

Let's say I have the following situation: B---D---F---G topic / / --A---C---E master For code review purposes, I would like to pull out a diff from commit A to commit G, but not including commits E and C which happened on the master…
Vladimir Mitrovic
  • 1,780
  • 17
  • 15
16
votes
3 answers

Elasticsearch aggregation on object

How do I can run an aggregation query only on object property, but get all properties in result? e.g. I want to get [{'doc_count': 1, 'key': {'id': 1, 'name': 'tag name'}}], but got [{'doc_count': 1, 'key': '1'] instead. Aggregation on field 'tags'…
Dmytro Sadovnychyi
  • 6,171
  • 5
  • 33
  • 60
15
votes
3 answers

Pandas: Average value for the past n days

I have a Pandas data frame like this: test = pd.DataFrame({ 'Date' : ['2016-04-01','2016-04-01','2016-04-02', '2016-04-02','2016-04-03','2016-04-04', '2016-04-05','2016-04-06','2016-04-06'], …
ahoosh
  • 1,340
  • 3
  • 17
  • 31
15
votes
2 answers

How to filter an elasticsearch global aggregation?

What I want to achieve: I want my "age" aggregation to not be filtered by the query filter and I want to be able to apply filters to it. So if I start with this query: { "query":{ "filtered":{ "filter":{ "terms":{…
adrienbourgeois
  • 423
  • 1
  • 3
  • 8
15
votes
1 answer

how to return the count of unique documents by using elasticsearch aggregation

I encountered a problem that elasticsearch could not return the count of unique documents by just using terms aggregation on a nested field. Here is an example of our model: { ..., "location" : [ {"city" : "new york", "state" :…
milodky
  • 443
  • 2
  • 7
  • 18
15
votes
3 answers

Is there an aggregateBy method in the stream Java 8 api?

Run across this very interesting but one year old presentation by Brian Goetz - in the slide linked he presents an aggregateBy() method supposedly in the Stream API, which is supposed to aggregate the elements of a list (?) to a map (given a default…
Mr_and_Mrs_D
  • 32,208
  • 39
  • 178
  • 361
14
votes
3 answers

How is an aggregator built?

Let's say I want to aggregate information related to a specific niche from many sources (could be travel, technology, or whatever). How would I do that? Have a spider/crawler who will crawl the web for finding the information I need (how would I…
Mircea
14
votes
1 answer

Maven Inheritance and Aggregation Example Architecture

I have a question regarding how best to re-structure a number of individual Maven projects using a combination of inheritance and aggregation. Setting the scene: There are 3 code based existing Maven projects all developed by the same team. 1…
noosy
  • 258
  • 2
  • 6
14
votes
2 answers

Efficiently Computing Significant Terms in SQL

I was introduced to ElasticSearch significant terms aggregation a while ago and was positively surprised how good and relevant this metric turns out to be. For those not familiar with it, it's quite a simple concept - for a given query (foreground…
Alix Axel
  • 151,645
  • 95
  • 393
  • 500
13
votes
0 answers

Spark - RelationalGroupedDataset vs. KeyvalueGroupedDataset? When should I use each of them?

When grouping a Dataset in Spark, there are two methods: groupBy and groupByKey[K]. groupBy returns RelationalGroupedDataset, while groupByKey[K] returns KeyvalueGroupedDataset. What are the differences between them? Under what circumstances…
CyberPlayerOne
  • 3,078
  • 5
  • 30
  • 51
13
votes
1 answer

Maven: Aggregation vs. Dependency

I'm very new to Maven and am just now trying to set up my first project tree. I'm struggling to understand the difference between two alternatives: I have jar and war projects (two each) that i want to bundle. Traditionally I'd just create an ear…
apropoz
  • 327
  • 1
  • 3
  • 9