Elasticsearch: How to set custom record count based on a type in search result


(yyh3011) #1

I have a search request like this:

My docs have a type, and the types like "sport", "health", "news" and etc,
and now I want the result count is mapping percent by types: sport 10%,
health 30%, news 60%.

Eg: if I search to get 200 records, I expect that the 200 records include
20 news records, 60 health records and 120 news records.

I know I can calculate this after multiple search, but can I do it using
one query?

thanks for any suggest!

johnson

--
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/229aa050-51b9-46b6-8c89-0d457ca6c71f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(yyh3011) #2

Anyone can give any suggests? thanks!

--
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/693c5811-1124-4022-b572-cdac5399ae74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Adrien Grand) #3

Hi,

It is not possible to do it in a single query. I think the easiest way to
do that would be to issue several queries and merge results on client side.

On Tue, Apr 15, 2014 at 8:07 AM, yyh3011@gmail.com wrote:

Anyone can give any suggests? thanks!

--
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/693c5811-1124-4022-b572-cdac5399ae74%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/693c5811-1124-4022-b572-cdac5399ae74%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/CAL6Z4j62jPdi3pN%2BfOOs0he1duGdaMXYmW_mtVu60F5z7-uZmQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4