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

[feature request] Parent aggregation #9705

Closed
Kamapcuc opened this issue Feb 15, 2015 · 12 comments
Closed

[feature request] Parent aggregation #9705

Kamapcuc opened this issue Feb 15, 2015 · 12 comments
Assignees
Labels
high hanging fruit :Search/Search Search-related issues that do not fall into other categories

Comments

@Kamapcuc
Copy link

For example, I have data:

PUT test
PUT test/battle/_mapping
{
  "battle": {
    "_parent": {
      "type": "tank"
    }
  }
}

PUT test/tank/sherman
{"nation" : "usa"}

PUT test/tank/hellcat
{"nation" : "usa"}

PUT test/tank/panter
{"nation" : "germany"}

PUT test/battle/1?parent=sherman
PUT test/battle/2?parent=hellcat
PUT test/battle/3?parent=hellcat
PUT test/battle/4?parent=hellcat
PUT test/battle/5?parent=panter
PUT test/battle/6?parent=panter
{
  "date": "15.02.2015",
  "result": "win"
}

So, I played 4 battles on American tanks and 2 on German tanks. I want to receive those data, when searching for battles. But I can do it only when I search for tanks:

GET test/tank/_search
{
  "size": 0,
  "aggs": {
    "nation": {
      "terms": {
        "field": "nation"
      },
      "aggs": {
        "battles_count": {
          "children": {
            "type": "battle"
          }
        }
      }
    }
  }
}

Although, I can make such a monster:

GET replays/battle/_search
{
  "size": 0,
  "aggs": {
    "usa": {
      "filter": {
        "has_parent": {
          "parent_type": "tank",
          "query": {
            "term": {
              "nation": "usa"
            }
          }
        }
      },
      "aggs": {
        "count": {
          "value_count": {
            "field": "_id"
          }
        }
      }
    },
    "germany": {
      "filter": {
        "has_parent": {
          "parent_type": "tank",
          "query": {
            "term": {
              "nation": "germany"
            }
          }
        }
      },
      "aggs": {
        "count": {
          "value_count": {
            "field": "_id"
          }
        }
      }
    }
  }
}

But it's VERY uncomfortable and I must know all the terms of nation field. So, I'm asking for some kind of parent aggregation.

@Kamapcuc Kamapcuc changed the title [featrue request] Parent aggregation [ feature request] Parent aggregation Feb 15, 2015
@Kamapcuc Kamapcuc changed the title [ feature request] Parent aggregation [feature request] Parent aggregation Feb 15, 2015
@Kamapcuc
Copy link
Author

Kamapcuc commented Apr 1, 2015

Can you please explain what is "high hanging fruit"?
I can suggest that mean lowest priority - am i right?

@javanna
Copy link
Member

javanna commented Apr 1, 2015

Hi @Kamapcuc good question :) it's not about priority, more about the effort required for the change. Low hanging fruits are easier to get than high hanging ones, that's it. Issues marked with the "high hanging fruit" label might require some refactoring on our end for instance, but that doesn't mean we make all of the easy changes first.

@gmenegatti
Copy link

Hi @martijnvg, now that the Parent/Child refactor was committed, do you think we can expect the Parent Aggregation in a near future?

@ppf2
Copy link
Member

ppf2 commented Jun 27, 2015

+1

@Kamapcuc
Copy link
Author

Kamapcuc commented Oct 1, 2015

is there any progress?

@Kamapcuc
Copy link
Author

Ok, i think it's time to start to contribute to the project ))

@clintongormley
Copy link

I doubt this is ever going to come to pass. Closing

@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Parent/Child labels Feb 14, 2018
@DavidHauger
Copy link

Would love and need that, too! Maybe with the new ways of joining in elastic 6?

@centic9
Copy link
Contributor

centic9 commented Sep 12, 2018

Yeah, I miss this a lot as well, prevents us from switching from nested to parent/child for one of our large use-cases...

@centic9
Copy link
Contributor

centic9 commented Oct 2, 2018

I tried to implement the parent-aggregation and would like some feedback if the approach is correct, see #34210

@jimczi jimczi reopened this Nov 8, 2018
@jimczi
Copy link
Contributor

jimczi commented Nov 8, 2018

Oups I reopened the issue by mistake. #34210 has been merged so we'll have support for parent aggregation starting in version 6.6. Thanks again @centic9 !

@jimczi jimczi closed this as completed Nov 8, 2018
@Kamapcuc
Copy link
Author

Yeah, thanks you @centic9 ! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high hanging fruit :Search/Search Search-related issues that do not fall into other categories
Projects
None yet
Development

No branches or pull requests

9 participants