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

Aggregate on nested objects #2243

Closed
mickaelmagniez opened this issue Dec 11, 2014 · 1 comment
Closed

Aggregate on nested objects #2243

mickaelmagniez opened this issue Dec 11, 2014 · 1 comment

Comments

@mickaelmagniez
Copy link

Hi,

On Kibana 4.0.0-BETA2, i'm trying to make aggregation on nested objects, but the query send to elastic search is not correct :

This query is send by kibana :

{
    "size": 0,
    "query": {},
    "aggs": {
        "agg_53": {
            "date_histogram": {
                "field": "@timestamp",
                "interval": "day",
                "min_doc_count": 1,
                "extended_bounds": {
                    "min": "2013-12-31T23:00:00.000Z",
                    "max": "2014-01-31T22:59:59.999Z"
                }
            },
            "aggs": {
                "agg_54": {
                    "terms": {
                        "field": "steps.duration",
                        "size": 40,
                        "order": {
                            "_count": "desc"
                        }
                    }
                }
            }
        }
    }
}

Query should be :

{
    "size": 0,
    "query": {}
    "aggs": {
        "agg_53": {
            "date_histogram": {
                "field": "@timestamp",
                "interval": "day",
                "min_doc_count": 1,
                "extended_bounds": {
                    "min": "2013-12-31T23:00:00.000Z",
                    "max": "2014-01-31T22:59:59.999Z"
                }
            },
            "aggs": {
                "agg_54": {
                    "nested": {
                        "path": "steps"
                    },
                    "aggs": {
                        "agg_55": {
                            "terms": {
                                "field": "steps.worker",
                                "size": 5,
                                "order": {
                                    "_count": "desc"
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

Here is my mapping

{
    "treatment": {
        "properties": {
            "@timestamp": {
                "type": "date",
                "format": "dateOptionalTime"
            },
            "steps": {
                "type": "nested",
                "properties": {
                    "worker": {
                        "type": "string"
                    },
                    "duration": {
                        "type": "double"
                    }
                }
            }
        }
    }
}

Is there a way to aggregate on nested objects, or to make custpm aggregates (manually input json)

Best regards,

@rashidkpc
Copy link
Contributor

Duplicate of #1084

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants