How to aggregate by metadata (types/field names)?


(ElasticSearch Users mailing list) #1

Hi, I'm trying to create a query that will return count of hits per doc
type and field name.
For example if I have the following docs:
type X
[
{f1: ..., f2: "a b c"},
{f1: ..., f2: "b c d"},
{f1: ..., f2: "c d e"},
]

type Y
[
{f3: ..., f4: "d e f"},
{f3: ..., f4: "e f g"},
{f3: ..., f4: "f g h"},
]

I want to query for types and field names containing hits for "d":
[
{Type: X, Field: f2, Count: 2}
{Type: Y, Field: f4, Count: 1}
]

I don't want to run a query that will pull all docs matching "d" and then
aggregate metadata on the client as the number of docs can be really big...
I've searched this group and found couple posts suggesting to read mappings
to figure out types and field names, but I don't want to run separate query
per typeXfieldname as metadata in my case can be really big (number of
typeXfieldName can be in hundreds).

Well, I can actually push doc type into each document as a field, but I'm
still left with aggregation by field name hits...

--
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/583d45e9-ea2b-4567-9f97-93f4c545b99d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(ElasticSearch Users mailing list) #2

bump

I'm new to elastic, considering to move from a proprietary system...
I'm blocked on the fact that I can't get list of field hits per document as
part of search results... Any help any clue?

--
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/19e12a97-9db5-4d54-b8dd-91662c82a22a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Alexander Reelsen) #3

Hey,

you could take a look at the terms aggregation using the _type field, which
contains the type information. See
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#search-aggregations-bucket-terms-aggregation

--Alex

On Thu, May 1, 2014 at 4:04 AM, 'almineev .' via elasticsearch <
elasticsearch@googlegroups.com> wrote:

bump

I'm new to elastic, considering to move from a proprietary system...
I'm blocked on the fact that I can't get list of field hits per document
as part of search results... Any help any clue?

--
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/19e12a97-9db5-4d54-b8dd-91662c82a22a%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/19e12a97-9db5-4d54-b8dd-91662c82a22a%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/CAGCwEM8Nyg2tS_fJ%3D_PX8HXtMeutXx7cpebpzvaFLZP5JOuOzg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4