Facet document fields themselves, rather than their values

Hi,

Given a query, I need to get a list of the fields that exist in the
matching documents.

To illustrate: let's say I have a set of documents with two fields - 'city'
and 'temperature'. I can get a faceted view by city like so:

{"facets": {"city_facet" : {"terms": {"field" : "city"}}}}
results in:
{
"term" : "sydney",
"count" : 1335
}, {
"term" : "London",
"count" : 1333
}, {
"term" : "SanFran",
"count" : 1325
}... etc

But, what I would like is for some way to facet on the fields themselves,
ie something like so:

{"facets": {"field_facet" : {"terms": {"field" : "?FIELD??"}}}}
results in:
{
"field" : "temperature",
"count" : 2050
}, {
"field" : "city",
"count" : 2104
}

Is this possible, or does someone have a good suggestion for how I might
fake it?

Thanks
A

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hey,

if I got your requirement right, you want to count for documents, which
have a certain field set? Then you might not need faceting for that.
What about a count request using an exists filter? One count request for
each field you want to count, or one if you want to combine.

If I got your requirement wrong, please elaborate and we try to get it
right.

--Alex

On Wed, Jun 12, 2013 at 8:06 AM, Allan Johns nerdvegas@gmail.com wrote:

Hi,

Given a query, I need to get a list of the fields that exist in the
matching documents.

To illustrate: let's say I have a set of documents with two fields -
'city' and 'temperature'. I can get a faceted view by city like so:

{"facets": {"city_facet" : {"terms": {"field" : "city"}}}}
results in:
{
"term" : "sydney",
"count" : 1335
}, {
"term" : "London",
"count" : 1333
}, {
"term" : "SanFran",
"count" : 1325
}... etc

But, what I would like is for some way to facet on the fields themselves,
ie something like so:

{"facets": {"field_facet" : {"terms": {"field" : "?FIELD??"}}}}
results in:
{
"field" : "temperature",
"count" : 2050
}, {
"field" : "city",
"count" : 2104
}

Is this possible, or does someone have a good suggestion for how I might
fake it?

Thanks
A

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

No that isn't what I want.

Given an arbitrary query, I want a list of the fields that exist in any of
the matching documents.

So, let's say a query results in two matching documents:
{"foo":"bah", "eek":"true"},
{"foo":"fah", "priority":12}

I want to get the result ["foo", "eek", "priority"].

hth
A

On Wed, Jun 12, 2013 at 4:29 PM, Alexander Reelsen alr@spinscale.de wrote:

Hey,

if I got your requirement right, you want to count for documents, which
have a certain field set? Then you might not need faceting for that.
What about a count request using an exists filter? One count request for
each field you want to count, or one if you want to combine.

If I got your requirement wrong, please elaborate and we try to get it
right.

--Alex

On Wed, Jun 12, 2013 at 8:06 AM, Allan Johns nerdvegas@gmail.com wrote:

Hi,

Given a query, I need to get a list of the fields that exist in the
matching documents.

To illustrate: let's say I have a set of documents with two fields -
'city' and 'temperature'. I can get a faceted view by city like so:

{"facets": {"city_facet" : {"terms": {"field" : "city"}}}}
results in:
{
"term" : "sydney",
"count" : 1335
}, {
"term" : "London",
"count" : 1333
}, {
"term" : "SanFran",
"count" : 1325
}... etc

But, what I would like is for some way to facet on the fields themselves,
ie something like so:

{"facets": {"field_facet" : {"terms": {"field" : "?FIELD??"}}}}
results in:
{
"field" : "temperature",
"count" : 2050
}, {
"field" : "city",
"count" : 2104
}

Is this possible, or does someone have a good suggestion for how I might
fake it?

Thanks
A

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.