# "from" without "size" does nothing

**URL:** https://discuss.elastic.co/t/from-without-size-does-nothing/3268
**Category:** Elasticsearch
**Created:** [August 27, 2010, 3:43pm UTC](https://discuss.elastic.co/t/from-without-size-does-nothing/3268 "2010-08-27T15:43:06Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Kenneth\_Loafman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kenneth_loafman/32/2224_2.png) [@Kenneth\_Loafman](https://discuss.elastic.co/u/Kenneth_Loafman)
#### Post date: [August 27, 2010, 3:43pm UTC](https://discuss.elastic.co/t/from-without-size-does-nothing/3268/1 "2010-08-27T15:43:06Z")

</div>

Hi,

If I execute the following ES returns the correct set of posts, 2000-2024.

> #!/bin/bash
> 
> curl -XGET '[http://192.168.1.5:9200/\_search](http://192.168.1.5:9200/_search)' -d @- \<\<EOF | python  
> -mjson.tool  
> {  
> "query" : {  
> "more\_like\_this" : {  
> "fields" : ["content", "title"],  
> "like\_text" : "jetblue blew tire",  
> "min\_term\_freq" : 1  
> },  
> "from" : 2000,  
> "size" : 25  
> }  
> }  
> EOF  
> However, leaving out the "size" (defaulting), always returns posts 0-24,  
> and ignores the "from" parameter.  
> #!/bin/bash
> 
> curl -XGET '[http://192.168.1.5:9200/\_search](http://192.168.1.5:9200/_search)' -d @- \<\<EOF | python  
> -mjson.tool  
> {  
> "query" : {  
> "more\_like\_this" : {  
> "fields" : ["content", "title"],  
> "like\_text" : "jetblue blew tire",  
> "min\_term\_freq" : 1  
> },  
> "from" : 2000  
> }  
> }  
> EOF  
> Is this expected behavior? I can't find documentation either way.

...Thanks,  
...Ken

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [August 27, 2010, 3:50pm UTC](https://discuss.elastic.co/t/from-without-size-does-nothing/3268/2 "2010-08-27T15:50:53Z")

</div>

Strange that it works for you, the "from" and "size" should be set on the  
same "query" level:  
[http://www.elasticsearch.com/docs/elasticsearch/rest\_api/search/from\_size/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/from_size/).

On Fri, Aug 27, 2010 at 6:43 PM, Kenneth Loafman  
[kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com)wrote:

> Hi,
> 
> If I execute the following ES returns the correct set of posts, 2000-2024.
> 
> > #!/bin/bash
> > 
> > curl -XGET '[http://192.168.1.5:9200/\_search](http://192.168.1.5:9200/_search)' -d @- \<\<EOF | python  
> > -mjson.tool  
> > {  
> > "query" : {  
> > "more\_like\_this" : {  
> > "fields" : ["content", "title"],  
> > "like\_text" : "jetblue blew tire",  
> > "min\_term\_freq" : 1  
> > },  
> > "from" : 2000,  
> > "size" : 25  
> > }  
> > }  
> > EOF  
> > However, leaving out the "size" (defaulting), always returns posts 0-24,  
> > and ignores the "from" parameter.  
> > #!/bin/bash
> > 
> > curl -XGET '[http://192.168.1.5:9200/\_search](http://192.168.1.5:9200/_search)' -d @- \<\<EOF | python  
> > -mjson.tool  
> > {  
> > "query" : {  
> > "more\_like\_this" : {  
> > "fields" : ["content", "title"],  
> > "like\_text" : "jetblue blew tire",  
> > "min\_term\_freq" : 1  
> > },  
> > "from" : 2000  
> > }  
> > }  
> > EOF  
> > Is this expected behavior? I can't find documentation either way.
> 
> ...Thanks,  
> ...Ken

---

<div class="post-metadata">

### Author: ![Kenneth\_Loafman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kenneth_loafman/32/2224_2.png) [@Kenneth\_Loafman](https://discuss.elastic.co/u/Kenneth_Loafman)
#### Post date: [August 27, 2010, 4:12pm UTC](https://discuss.elastic.co/t/from-without-size-does-nothing/3268/3 "2010-08-27T16:12:21Z")

</div>

They are on the same query level, just not on the same line. The docs  
don't say that 'size' is required when 'from' is supplied.

Shay Banon wrote:

> Strange that it works for you, the "from" and "size" should be set on  
> the same "query"  
> level: [http://www.elasticsearch.com/docs/elasticsearch/rest\_api/search/from\_size/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/from_size/).
> 
> On Fri, Aug 27, 2010 at 6:43 PM, Kenneth Loafman  
> \<[kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com) [mailto:kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com)\> wrote:
> 
> ```
> Hi,
> 
> If I execute the following ES returns the correct set of posts,
> 2000-2024.
> > #!/bin/bash
> >
> > curl -XGET 'http://192.168.1.5:9200/_search' -d @- <<EOF | python
> > -mjson.tool
> > {
> > "query" : {
> > "more_like_this" : {
> > "fields" : ["content", "title"],
> > "like_text" : "jetblue blew tire",
> > "min_term_freq" : 1
> > },
> > "from" : 2000,
> > "size" : 25
> > }
> > }
> > EOF
> However, leaving out the "size" (defaulting), always returns posts 0-24,
> and ignores the "from" parameter.
> > #!/bin/bash
> >
> > curl -XGET 'http://192.168.1.5:9200/_search' -d @- <<EOF | python
> > -mjson.tool
> > {
> > "query" : {
> > "more_like_this" : {
> > "fields" : ["content", "title"],
> > "like_text" : "jetblue blew tire",
> > "min_term_freq" : 1
> > },
> > "from" : 2000
> > }
> > }
> > EOF
> Is this expected behavior? I can't find documentation either way.
> 
> ...Thanks,
> ...Ken
> 
> ```

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [August 27, 2010, 4:17pm UTC](https://discuss.elastic.co/t/from-without-size-does-nothing/3268/4 "2010-08-27T16:17:14Z")

</div>

Here is how it should look like: [gist:553660 · GitHub](http://gist.github.com/553660).

On Fri, Aug 27, 2010 at 7:12 PM, Kenneth Loafman  
[kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com)wrote:

> They are on the same query level, just not on the same line. The docs  
> don't say that 'size' is required when 'from' is supplied.
> 
> Shay Banon wrote:
> 
> > Strange that it works for you, the "from" and "size" should be set on  
> > the same "query"  
> > level:  
> > [http://www.elasticsearch.com/docs/elasticsearch/rest\_api/search/from\_size/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/from_size/)  
> > .
> > 
> > On Fri, Aug 27, 2010 at 6:43 PM, Kenneth Loafman  
> > \<[kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com) [mailto:kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com)\> wrote:
> > 
> > ```
> > Hi,
> > 
> > If I execute the following ES returns the correct set of posts,
> > 2000-2024.
> > > #!/bin/bash
> > >
> > > curl -XGET 'http://192.168.1.5:9200/_search' -d @- <<EOF | python
> > > -mjson.tool
> > > {
> > > "query" : {
> > > "more_like_this" : {
> > > "fields" : ["content", "title"],
> > > "like_text" : "jetblue blew tire",
> > > "min_term_freq" : 1
> > > },
> > > "from" : 2000,
> > > "size" : 25
> > > }
> > > }
> > > EOF
> > However, leaving out the "size" (defaulting), always returns posts
> > 
> > ```
> 
> 0-24,
> 
> > ```
> > and ignores the "from" parameter.
> > > #!/bin/bash
> > >
> > > curl -XGET 'http://192.168.1.5:9200/_search' -d @- <<EOF | python
> > > -mjson.tool
> > > {
> > > "query" : {
> > > "more_like_this" : {
> > > "fields" : ["content", "title"],
> > > "like_text" : "jetblue blew tire",
> > > "min_term_freq" : 1
> > > },
> > > "from" : 2000
> > > }
> > > }
> > > EOF
> > Is this expected behavior? I can't find documentation either way.
> > 
> > ...Thanks,
> > ...Ken
> > 
> > ```

---

<div class="post-metadata">

### Author: ![Kenneth\_Loafman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kenneth_loafman/32/2224_2.png) [@Kenneth\_Loafman](https://discuss.elastic.co/u/Kenneth_Loafman)
#### Post date: [August 27, 2010, 4:46pm UTC](https://discuss.elastic.co/t/from-without-size-does-nothing/3268/5 "2010-08-27T16:46:11Z")

</div>

OK, that did it. Thanks!

Shay Banon wrote:

> Here is how it should look like: [gist:553660 · GitHub](http://gist.github.com/553660).
> 
> On Fri, Aug 27, 2010 at 7:12 PM, Kenneth Loafman  
> \<[kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com) [mailto:kenneth.loafman@gmail.com](mailto:kenneth.loafman@gmail.com)\> wrote:
> 
> ```
> They are on the same query level, just not on the same line. The docs
> don't say that 'size' is required when 'from' is supplied.
> 
> Shay Banon wrote:
> > Strange that it works for you, the "from" and "size" should be set on
> > the same "query"
> > level:
> http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/from_size/.
> >
> > On Fri, Aug 27, 2010 at 6:43 PM, Kenneth Loafman
> > <kenneth.loafman@gmail.com <mailto:kenneth.loafman@gmail.com>
> <mailto:kenneth.loafman@gmail.com
> <mailto:kenneth.loafman@gmail.com>>> wrote:
> >
> > Hi,
> >
> > If I execute the following ES returns the correct set of posts,
> > 2000-2024.
> > > #!/bin/bash
> > >
> > > curl -XGET 'http://192.168.1.5:9200/_search' -d @- <<EOF |
> python
> > > -mjson.tool
> > > {
> > > "query" : {
> > > "more_like_this" : {
> > > "fields" : ["content", "title"],
> > > "like_text" : "jetblue blew tire",
> > > "min_term_freq" : 1
> > > },
> > > "from" : 2000,
> > > "size" : 25
> > > }
> > > }
> > > EOF
> > However, leaving out the "size" (defaulting), always returns
> posts 0-24,
> > and ignores the "from" parameter.
> > > #!/bin/bash
> > >
> > > curl -XGET 'http://192.168.1.5:9200/_search' -d @- <<EOF |
> python
> > > -mjson.tool
> > > {
> > > "query" : {
> > > "more_like_this" : {
> > > "fields" : ["content", "title"],
> > > "like_text" : "jetblue blew tire",
> > > "min_term_freq" : 1
> > > },
> > > "from" : 2000
> > > }
> > > }
> > > EOF
> > Is this expected behavior? I can't find documentation either way.
> >
> > ...Thanks,
> > ...Ken
> >
> >
> 
> ```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 4:20am UTC](https://discuss.elastic.co/t/from-without-size-does-nothing/3268/6 "2017-07-06T04:20:13Z")

</div>


