How to control the returned record number in filter?


(yyh3011) #1

In ES, we can use "from" and "size" to control the returned record number
in query, but can I also control them in filter?
the limit filter is worked on every shard, so I think it's not work for me.

thanks
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/8beb2be5-488b-4a63-8980-fa878a997a34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Adrien Grand) #2

Can you tell us more about what you are trying to achieve?

On Tue, Apr 15, 2014 at 10:23 AM, yyh3011@gmail.com wrote:

In ES, we can use "from" and "size" to control the returned record number
in query, but can I also control them in filter?
the limit filter is worked on every shard, so I think it's not work for me.

thanks
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/8beb2be5-488b-4a63-8980-fa878a997a34%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/8beb2be5-488b-4a63-8980-fa878a997a34%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/CAL6Z4j7Wyjm6bsnxE7PsKxrh5b9P5oZaEoLiQZoFhakp_x5KyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(yyh3011) #3

hi Adrien,

Thanks for your response!

Actually, the basic requirement is
at https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/elasticsearch/kiQ0FGFKUkA

I asked some questions all about this requirement, now I know I can get my
expected result using multi search, as I said
in https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/elasticsearch/JyhIHSWQuTM
but I want to know if there is a better way to do this with high
performance, the followings are my questions and thoughts:

  1. Can I control the returned records number in Filter? if yes, then I can
    get the result in single query, the structure pseudocode of queryDSL like:

query:
"from": 1,
"size":20
"more like" : qeury content",
{
filter : "topic" :"Sport", from:0,szie:6,
or
filter : "topic" :"Top", from:0,szie:8,
or
filter : "topic" :"Business", from:0,szie:6
}
sort: data, _score

  1. Can I use filter in multi searchs? if yes, then I can organize my multi
    search as following, pseudocode of queryDSL :
    {
    query: "query content", filter: topic="Sport", from:0,szie:6,
    query: "query content", filter: topic="Top", from:0,szie:8,
    query: "query content", filter: topic="Business", from:0,szie:6,
    }
    then the each search in multi search will search SAMEcontent, then
    filter by different topic, and return records by number

and now I use multi search like:
{"query":{ "bool":{ "must":[{ "more_like_this_field" : { "content"
:{"like_text" : "James", "min_term_freq":1, "max_query_terms" : 12}} }, {
"match":{"topic":"Top"} }] }}, "from" : 0, "size" : 8}
{"query":{ "bool":{ "must":[{ "more_like_this_field" : { "content"
:{"like_text" : "James", "min_term_freq":1, "max_query_terms" : 12}} }, {
"match":{"topic":"Business"} }] }}, "from" : 0, "size" :6}
{"query":{ "bool":{ "must":[{ "more_like_this_field" : { "content"
:{"like_text" : "James", "min_term_freq":1, "max_query_terms" : 12}} }, {
"match":{"topic":"Sport"} }] }}, "from" : 0, "size" : 6}

you can see the each query in multi search will query difference content
like "content" and "Top", "content" and "Sport", so do you think the
performance of first multi search is better than the secound's?

please let know if there is any mistakes, and could you please also give me
example about this requirement for high performance?

thanks
Johnson

在 2014年4月15日星期二UTC+8下午6时33分15秒,Adrien Grand写道:

Can you tell us more about what you are trying to achieve?

On Tue, Apr 15, 2014 at 10:23 AM, <yyh...@gmail.com <javascript:>> wrote:

In ES, we can use "from" and "size" to control the returned record number
in query, but can I also control them in filter?
the limit filter is worked on every shard, so I think it's not work for
me.

thanks
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/8beb2be5-488b-4a63-8980-fa878a997a34%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/8beb2be5-488b-4a63-8980-fa878a997a34%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/9e8f8a01-2b75-4b22-a674-86ba33e5a927%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4