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

Unable to aggregate on _index #5848

Closed
berggren opened this issue Apr 17, 2014 · 2 comments · Fixed by #6073

Comments

@berggren
Copy link

commented Apr 17, 2014

When using the aggregations module I am unable to get aggregated doc counts per index.

The following query DO NOT return the aggregated result per index:

{
  "query": {
    "match_all": {}
  },
  "size": 0,
  "aggs": {
    "type": {
      "terms": {
        "field": "_index"
      }
    }
  }
}

When I use Facets instead of aggs, I get the desired result:

{
  "query": {
    "match_all": {}
  },
  "size": 0,
  "facets": {
    "type": {
      "terms": {
        "field": "_index"
      }
    }
  }
}

Is this a known issue?

@jpountz jpountz self-assigned this Apr 17, 2014
@clintongormley

This comment has been minimized.

Copy link
Member

commented Apr 17, 2014

/cc @jpountz

Looks like the _index field is not indexed. Probably facets has a workaround for it?

@jpountz

This comment has been minimized.

Copy link
Contributor

commented Apr 18, 2014

@clintongormley Facets indeed have special handling for this field.

I think we can have a cleaner fix for this, eg. by making field mappers responsible for producing field data, so that a field which is neither indexed nor doc-valued but knows what its field data looks like could return a non-empty instance. I need to think more about this...

@jpountz jpountz added v2.0.0 labels May 7, 2014
jpountz added a commit to jpountz/elasticsearch that referenced this issue May 7, 2014
This makes aggregations work on the _index field, and also allows to remove the
special facet aggregator for the _index field.

Close elastic#5848
jpountz added a commit that referenced this issue May 7, 2014
This makes aggregations work on the _index field, and also allows to remove the
special facet aggregator for the _index field.

Close #5848
@jpountz jpountz closed this in #6073 May 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.