Is there a way to do scan with limit?

I want to for example, fast get 1m out of 5m records.
I am currently using:

SearchResponse scrollResp = this.client
.prepareSearch(esQuery.indices)

.addFields(esQuery.fields)

.setSearchType(SearchType.SCAN)

.setScroll(

TimeValue

.timeValueSeconds(this.scrollTimeInSeconds))

.setQuery(esQuery.query)

.setSize(this.queryBatchSizePershard).execute().actionGet();

but the setSize defines how many records return per shard in one scroll. Is
there a way to define a limit? or I have to control the limit in my code.

Chen

--
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/5fb4751f-7080-423c-9acd-bfd56abfd844%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Is there a reason not to control the limit in your code?

On Thursday, April 2, 2015 at 6:31:07 PM UTC-6, Chen Wang wrote:

I want to for example, fast get 1m out of 5m records.
I am currently using:

SearchResponse scrollResp = this.client
.prepareSearch(esQuery.indices)

.addFields(esQuery.fields)

.setSearchType(SearchType.SCAN)

.setScroll(

TimeValue

.timeValueSeconds(this.scrollTimeInSeconds))

.setQuery(esQuery.query)

.setSize(this.queryBatchSizePershard).execute().actionGet();

but the setSize defines how many records return per shard in one scroll.
Is there a way to define a limit? or I have to control the limit in my code.

Chen

--
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/b863b45e-5e1b-4aa7-8ac9-8b9715b7cc71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I was thinking that being able to do limit on ES side can reduce its query load.

--
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/647b7cf9-1351-42d3-8238-fa2118b9f0b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Unless I am mistaken, that is already the job of the scan query, reducing
the load caused by sorting a query. There would be no reduction by
limiting the result set.

As I understand it the scan query identifies which shards has results, and
then just starts serving the first results first without any sort. This
continues until the shard has no more results. ElasticSearch only needs to
track which results it has already sent, and sends the next batch,
unsorted. This continues until you stop and the scan expires.

On Fri, Apr 3, 2015 at 11:45 AM, Chen Wang chen.apache.solr@gmail.com
wrote:

I was thinking that being able to do limit on ES side can reduce its query
load.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/-Y1wETKmuF0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/647b7cf9-1351-42d3-8238-fa2118b9f0b9%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CADqT7cH6w1EW%2B%2B%3Da%3D7C649dDReZOiCzB2X37hK%3DNiK%3D_Fs0FHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.