Occurance per another field

Hi ,

I have documents which are described in the

GIST - https://gist.github.com/1347280

In each document i have many companies. (Which i am putting in companies
list)
For each company i have attributes tag with values like "software" ,
"product" , "service" ... etc

When a search hits , i want to know which all companies are included in the
search (This can be done using term facets)
Now under each company , i want to know its tags.

Eg: Now when a query hit , the facet result should be something like

comapy : [ { name : yahoo , hits : 3 , tags : [ internet , software ,
product ] } ,
{ name : IBM , hits : 2 , tags : [ software , service ]}]

I figured out it has something to do with term_stat , but am not getting
it to work.

Can someone give an insight on this.

Thanks
Vineeth

It has nothing to do with terms stats. You can't do this with elasticsearch.

On Tue, Nov 8, 2011 at 10:22 AM, Vineeth Mohan vineethmohan@algotree.comwrote:

Hi ,

I have documents which are described in the

GIST - gist:1347280 · GitHub

In each document i have many companies. (Which i am putting in companies
list)
For each company i have attributes tag with values like "software" ,
"product" , "service" ... etc

When a search hits , i want to know which all companies are included in
the search (This can be done using term facets)
Now under each company , i want to know its tags.

Eg: Now when a query hit , the facet result should be something like

comapy : [ { name : yahoo , hits : 3 , tags : [ internet , software ,
product ] } ,
{ name : IBM , hits : 2 , tags : [ software , service ]}]

I figured out it has something to do with term_stat , but am not getting
it to work.

Can someone give an insight on this.

Thanks
Vineeth

I came up with a workaround here

Now instead of

list : [ {company : yahoo , tag : internet } ,
{company : IBM , tag : software }]

It would be

list : [ {company : yahoo , yahoo : internet } ,
{company : IBM , IBM : software }]

This way , i can first search for the company and with company name as
field name , i can run the facets to get the related details.

Thanks
Vineeth

On Wed, Nov 9, 2011 at 4:11 PM, Shay Banon kimchy@gmail.com wrote:

It has nothing to do with terms stats. You can't do this with
elasticsearch.

On Tue, Nov 8, 2011 at 10:22 AM, Vineeth Mohan vineethmohan@algotree.comwrote:

Hi ,

I have documents which are described in the

GIST - gist:1347280 · GitHub

In each document i have many companies. (Which i am putting in companies
list)
For each company i have attributes tag with values like "software" ,
"product" , "service" ... etc

When a search hits , i want to know which all companies are included in
the search (This can be done using term facets)
Now under each company , i want to know its tags.

Eg: Now when a query hit , the facet result should be something like

comapy : [ { name : yahoo , hits : 3 , tags : [ internet , software ,
product ] } ,
{ name : IBM , hits : 2 , tags : [ software , service ]}]

I figured out it has something to do with term_stat , but am not getting
it to work.

Can someone give an insight on this.

Thanks
Vineeth