Skip to content

Add an option to write the aggregation type in the response #7278

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

Closed
wants to merge 1 commit into from

Conversation

obourgain
Copy link
Contributor

This pull requests add two optional parameters to the aggregations toXContent, one to write the TYPE of the aggregation and the other to write the classname of the aggregation.

The type field exists for facets but not for aggregations. I believe these informations can be usefull to create mappers without having to either rely on the request or infering the type from the response.

Existing client will not be impacted because the new informations are optional, but they may start to use it.

Suggestions for the fields and parameters names are welcome.
Maybe writing class.getSimpleName() is more robust than class.getName() in regard of refactorings.

It would be wonderful if this could also be merged with branch 1.x.

ouput would be like :

{  
   "_type":"terms",
   "_concrete_type":"org.elasticsearch.search.aggregations.bucket.terms.StringTerms",
   "doc_count_error_upper_bound":0,
   "buckets":[  
      {  
         "key":"val0",
         "doc_count":1
      }
   ]
}

@jpountz
Copy link
Contributor

jpountz commented Aug 14, 2014

@obourgain We discussed this issue in #5867 which lead to #6465, which would add the ability to add arbitrary metadata to aggregations and have it back in the responses. It looks like the PR is a bit stalled however.

@jpountz jpountz closed this Aug 14, 2014
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

Successfully merging this pull request may close these issues.

2 participants