Re: Looking for a sexy solution for Aggregations

2014-11-10 Thread Ivan Brusic
The only solution that I can think of is to execute your query with a post
filter, not a filtered query. In this way, your aggregations by default
will not be filtered. You can then have two histograms, one with the post
filter used as an aggregation filter, and the other one left alone.

-- 
Ivan

On Fri, Nov 7, 2014 at 11:04 AM, kazoompa  wrote:

> Hi,
>
> Consider the aggregation below:
>
> "Sociodemographic_economic_characteristics": {
>   "terms": {
> "field": "Sociodemographic_economic_characteristics",
> "size": 0,
> "min_doc_count": 0,
> "order": {
>   "_term": "asc"
> }
>   }
> }
>
> This is the result without any filters:
>
> Enter code here...
>
>- Sociodemographic_economic_characteristics: {
>   - buckets: [
>  - {
> - key: Age
> - doc_count: 93
>  }
>  - {
> - key: Education
> - doc_count: 42
>  }
>  - {
> - key: Ethnic_race_religion
> - doc_count: 17
>  }
>  - {
> - key: Family_hh_struct
> - doc_count: 55
>  }
>  - {
> - key: Income
> - doc_count: 10
>  }
>  - {
> - key: Labour_retirement
> - doc_count: 150
>  }
>  - {
> - key: Marital_status
> - doc_count: 20
>  }
>  - {
> - key: Residence
> - doc_count: 20
>  }
>  - {
> - key: Sex
> - doc_count: 7
>  }
>   ]
>}
>
>
> This is the result with the filter:
>
>
>- Sociodemographic_economic_characteristics: {
>   - buckets: [
>  - {
> - key: Age
> - doc_count: 0
>  }
>  - {
> - key: Education
> - doc_count: 0
>  }
>  - {
> - key: Ethnic_race_religion
> - doc_count: 0
>  }
>  - {
> - key: Family_hh_struct
> - doc_count: 0
>  }
>  - {
> - key: Income
> - doc_count: 0
>  }
>  - {
> - key: Labour_retirement
> - doc_count: 150
>  }
>  - {
> - key: Marital_status
> - doc_count: 0
>  }
>  - {
> - key: Residence
> - doc_count: 0
>  }
>  - {
> - key: Sex
> - doc_count: 0
>  }
>   ]
>}
>
>
> I would like to find a way to have the two combined ine one query search
> such that the client can show the info in this manner:
>
> Age: 0/93
> Education: 0/42
> Ethnic_race_religion: 0/17
> Family_hh_struct: 0/55
> Income: 0/10
> Labour_retirement:150/150
> ...
>
>
> As alternatives, I considered doing a Multiple Search or two independent
> search queries, but is there any way to do this in one go using the
> Elasticsearch goodies (nested aggs, etc)
>
> Thanks,
> Ramin
>
>
>
>
>  --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/350c0c57-4f4d-41a0-ab37-e5075b2ddccb%40googlegroups.com
> 
> .
> 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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBKAF_COLnA8wR4m-Hnc4AMH%2BojkGy6sVan-CPU8PwnVQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Looking for a sexy solution for Aggregations

2014-11-09 Thread kazoompa
Hi,

Consider the aggregation below:

"Sociodemographic_economic_characteristics": {
  "terms": {
"field": "Sociodemographic_economic_characteristics",
"size": 0,
"min_doc_count": 0,
"order": {
  "_term": "asc"
}
  }
}

This is the result without any filters:

Enter code here...

   - Sociodemographic_economic_characteristics: {
  - buckets: [
 - {
- key: Age
- doc_count: 93
 }
 - {
- key: Education
- doc_count: 42
 }
 - {
- key: Ethnic_race_religion
- doc_count: 17
 }
 - {
- key: Family_hh_struct
- doc_count: 55
 }
 - {
- key: Income
- doc_count: 10
 }
 - {
- key: Labour_retirement
- doc_count: 150
 }
 - {
- key: Marital_status
- doc_count: 20
 }
 - {
- key: Residence
- doc_count: 20
 }
 - {
- key: Sex
- doc_count: 7
 }
  ]
   }


This is the result with the filter:


   - Sociodemographic_economic_characteristics: {
  - buckets: [
 - {
- key: Age
- doc_count: 0
 }
 - {
- key: Education
- doc_count: 0
 }
 - {
- key: Ethnic_race_religion
- doc_count: 0
 }
 - {
- key: Family_hh_struct
- doc_count: 0
 }
 - {
- key: Income
- doc_count: 0
 }
 - {
- key: Labour_retirement
- doc_count: 150
 }
 - {
- key: Marital_status
- doc_count: 0
 }
 - {
- key: Residence
- doc_count: 0
 }
 - {
- key: Sex
- doc_count: 0
 }
  ]
   }


I would like to find a way to have the two combined ine one query search 
such that the client can show the info in this manner:

Age: 0/93
Education: 0/42
Ethnic_race_religion: 0/17
Family_hh_struct: 0/55
Income: 0/10
Labour_retirement:150/150
...


As alternatives, I considered doing a Multiple Search or two independent 
search queries, but is there any way to do this in one go using the 
Elasticsearch goodies (nested aggs, etc)

Thanks,
Ramin




-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/350c0c57-4f4d-41a0-ab37-e5075b2ddccb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.