Nested fields and _field_names

I am trying to profile fields by counting documents with each given field.
I am using 1.3.0 ES, so I thought I can use:

aggs: {
docs : {
terms : {
field : _field_names,
size : 0
}
}
}

to give a count of documents with each specific field/path.

But this returns nothing for nested fields. When I use a mapping of

a : {
type : nested,
properties: {
x : {...}
y : {...}
}
}

for document structures like

a : [
{ x : ..., y: ... },
{ x : ..., y: ... }
]

The aggregate returns nothing for x and y. Is this a bug ?

Thanks,
Peter Li

--
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/c535ad64-ed80-446b-9927-13a424556a1c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

_field_names tracks the field names of the current index document, so if
you need to be in the context of your nested documents to aggregate on
their field names. That would give something like:

GET test/_search
{
"aggs": {
"nested_docs": {
"nested": {
"path": "a"
},
"aggs": {
"top_fields": {
"terms": {
"field": "_field_names",
"size": 10
}
}
}
}
}
}

On Tue, Aug 12, 2014 at 5:49 AM, Peter Li jenli.peter@gmail.com wrote:

I am trying to profile fields by counting documents with each given field.
I am using 1.3.0 ES, so I thought I can use:

aggs: {
docs : {
terms : {
field : _field_names,
size : 0
}
}
}

to give a count of documents with each specific field/path.

But this returns nothing for nested fields. When I use a mapping of

a : {
type : nested,
properties: {
x : {...}
y : {...}
}
}

for document structures like

a : [
{ x : ..., y: ... },
{ x : ..., y: ... }
]

The aggregate returns nothing for x and y. Is this a bug ?

Thanks,
Peter Li

--
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/c535ad64-ed80-446b-9927-13a424556a1c%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/c535ad64-ed80-446b-9927-13a424556a1c%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
Adrien Grand

--
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/CAL6Z4j6NcZrxezb%2BnEOcOQY-BCqazF3tp9oNGB130_fh_SooGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.