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
Closed

Unable to aggregate on _index #5848

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

Comments

@berggren
Copy link

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
Copy link

/cc @jpountz

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

@jpountz
Copy link
Contributor

jpountz 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 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants