Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ElasticSearch Aggregation Buckets #5695

Closed
chuntley opened this issue Oct 22, 2014 · 1 comment
Closed

ElasticSearch Aggregation Buckets #5695

chuntley opened this issue Oct 22, 2014 · 1 comment

Comments

@chuntley
Copy link

The current ElasticSearch implementation of aggregations is missing the ability to group aggregations into buckets. As stated on their documentation (http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-aggregations.html):

A family of aggregations that build buckets, where each bucket is associated with a key and a document criterion. When the aggregation is executed, all the buckets criteria are evaluated on every document in the context and when a criterion matches, the document is considered to "fall in" the relevant bucket. By the end of the aggregation process, we’ll end up with a list of buckets - each one with a set of documents that "belong" to it.

A simple implementation of this is returning aggregation results by day, for example:

{
  "size": 0,
  "query": {
    "filtered": {
      "filter": {
        "bool": {
          "must": [
            {
              "range": {
                "log_timestamp": {
                  "from": "2014-10-01",
                  "to": "2014-10-30"
                }
              }
            }
          ]
        }
      }
    }
  },
  "aggregations": {
    "by_day": {
      "date_histogram": {
        "field": "timestamp",
        "interval": "day"
      },
      "aggregations": {
        "run_time": {
          "avg": {
            "field": "run_time"
          }
        }
      }
    }
  }
}

Adding the ability to have parent/children in addAgg() should be sufficient for adding aggregation buckets.

@yii-bot
Copy link

yii-bot commented Jan 24, 2016

Issue moved to yiisoft/yii2-elasticsearch#59

@yii-bot yii-bot closed this as completed Jan 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants