Aggregations: Possible to return additional fields?

Is it possible to do a terms aggregation on a 'tags.id' field but also get
back the associated 'tags.slug' and 'tags.name' fields? Here's how the
documents are structured:

{
"id: 42,
"name": Beer,
"tags: [{
"id": 2,
"name": "Hoppy",
"slug": "hoppy"
}, {
"id": 2,
"name": "Hoppy",
"slug": "hoppy"
}]
}

Obviously, this is so that I can avoid additional database or elasticsearch
queries in order to display UI navigation/filtering elements.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/0ac8182e-5233-4e6e-8939-fe19bb455561%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hello James ,

You can try the following

  1. Make the tags field nested
  2. Do a 2 level aggregation with nested/term type aggregation on id
    attribute over name term aggregation. This way you will get all ids and the
    names associated with it.

Thanks
Vineeth

On Thu, Sep 18, 2014 at 3:03 AM, James Addison addi00@gmail.com wrote:

Is it possible to do a terms aggregation on a 'tags.id' field but also
get back the associated 'tags.slug' and 'tags.name' fields? Here's how
the documents are structured:

{
"id: 42,
"name": Beer,
"tags: [{
"id": 2,
"name": "Hoppy",
"slug": "hoppy"
}, {
"id": 2,
"name": "Hoppy",
"slug": "hoppy"
}]
}

Obviously, this is so that I can avoid additional database or
elasticsearch queries in order to display UI navigation/filtering elements.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/0ac8182e-5233-4e6e-8939-fe19bb455561%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/0ac8182e-5233-4e6e-8939-fe19bb455561%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5k%3D8bWs-CT3%3DmxmMNxhtH4a%3DwQ3otcz3TPNb9epVi5_gg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.