# Size parameter isn't working

**URL:** <https://discuss.elastic.co/t/size-parameter-isnt-working/4707>\
**Category:** Elasticsearch\
**Created:** [June 25, 2011, 8:00pm UTC](https://discuss.elastic.co/t/size-parameter-isnt-working/4707 "2011-06-25T20:00:16Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josh\_JRG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/josh_jrg/32/3113_2.png) [@Josh\_JRG](https://discuss.elastic.co/u/Josh_JRG)\
**Post date:** [June 25, 2011, 8:00pm UTC](https://discuss.elastic.co/t/size-parameter-isnt-working/4707/1 "2011-06-25T20:00:16Z")

</div>

The size parameter isn't working on either a query based or uri  
search. "hits" will give me the correct number or results (say,  
something like 27), but I still only get the first 10 results.

I'm using the following:

curl -XGET '[http://localhost:9200/indexname/indextype/\_search](http://localhost:9200/indexname/indextype/_search)' -d '{  
"from" : 0, "size" : 100,  
"query" : {  
"terms" : {  
"term1" : "value1",  
"term2" : "value2"  
}  
}  
}

OR

curl -XGET '[http://localhost:9200/indexname/indextype/\_search](http://localhost:9200/indexname/indextype/_search)?  
q=term:value,size=100'

Any ideas or help would be very much appreciated.

---

<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:** [June 25, 2011, 9:47pm UTC](https://discuss.elastic.co/t/size-parameter-isnt-working/4707/2 "2011-06-25T21:47:41Z")

</div>

The first curl looks good, do you get total\_hits that is higher then 10, and you say you only get 10 back? Can you gist a repro in this case? The second curl is wrong since size is another parameter, and should be separated using & from the q parameter.

On Saturday, June 25, 2011 at 11:00 PM, Josh JRG wrote:

> The size parameter isn't working on either a query based or uri  
> search. "hits" will give me the correct number or results (say,  
> something like 27), but I still only get the first 10 results.
> 
> I'm using the following:
> 
> curl -XGET '[http://localhost:9200/indexname/indextype/\_search](http://localhost:9200/indexname/indextype/_search)' -d '{  
> "from" : 0, "size" : 100,  
> "query" : {  
> "terms" : {  
> "term1" : "value1",  
> "term2" : "value2"  
> }  
> }  
> }
> 
> OR
> 
> curl -XGET '[http://localhost:9200/indexname/indextype/\_search](http://localhost:9200/indexname/indextype/_search)?  
> q=term:value,size=100'
> 
> Any ideas or help would be very much appreciated.

---

<div class="post-metadata">

**Author:** ![Josh\_JRG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/josh_jrg/32/3113_2.png) [@Josh\_JRG](https://discuss.elastic.co/u/Josh_JRG)\
**Post date:** [June 26, 2011, 1:46am UTC](https://discuss.elastic.co/t/size-parameter-isnt-working/4707/3 "2011-06-26T01:46:15Z")

</div>

Actually, the first curl causes elasticsearch to throw an "unable to  
parse" error. Am I improperly constructing a multi-term query? Is my  
syntax wrong? Yes, total\_hits comes back as a number higher than 10 (I  
believe it was 14 in my example), but the number of matching records  
being returned is still only 10. I'm unable to post a repro from my  
current location, but I will be able to tomorrow morning. I believe  
that was primarily occurring on my second curl (and you've explained  
why that is happening) though as the first one was giving me a parsing  
error. Is there any way to to a multi-term query with the URI format  
with something like: q=term:value, term2=value2&size=100 or is that  
not possible? I'm new to this, so getting a good grasp on the syntax  
is still an issue.

On Jun 25, 5:47 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> The first curl looks good, do you get total\_hits that is higher then 10, and you say you only get 10 back? Can you gist a repro in this case? The second curl is wrong since size is another parameter, and should be separated using & from the q parameter.
> 
> On Saturday, June 25, 2011 at 11:00 PM, Josh JRG wrote:
> 
> > The size parameter isn't working on either a query based or uri  
> > search. "hits" will give me the correct number or results (say,  
> > something like 27), but I still only get the first 10 results.
> 
> > I'm using the following:
> 
> > curl -XGET '[http://localhost:9200/indexname/indextype/\_search'-d](http://localhost:9200/indexname/indextype/_search'-d) '{  
> > "from" : 0, "size" : 100,  
> > "query" : {  
> > "terms" : {  
> > "term1" : "value1",  
> > "term2" : "value2"  
> > }  
> > }  
> > }
> 
> > OR
> 
> > curl -XGET '[http://localhost:9200/indexname/indextype/\_search](http://localhost:9200/indexname/indextype/_search)?  
> > q=term:value,size=100'
> 
> > Any ideas or help would be very much appreciated.

---

<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:** [June 26, 2011, 9:36am UTC](https://discuss.elastic.co/t/size-parameter-isnt-working/4707/4 "2011-06-26T09:36:32Z")

</div>

Yes, your first curl is not correct when it comes to the query structure. What do you mean by doing a query like term:value? You mean field:value? You want to query several fields?

On Sunday, June 26, 2011 at 4:46 AM, Josh JRG wrote:

> Actually, the first curl causes elasticsearch to throw an "unable to  
> parse" error. Am I improperly constructing a multi-term query? Is my  
> syntax wrong? Yes, total\_hits comes back as a number higher than 10 (I  
> believe it was 14 in my example), but the number of matching records  
> being returned is still only 10. I'm unable to post a repro from my  
> current location, but I will be able to tomorrow morning. I believe  
> that was primarily occurring on my second curl (and you've explained  
> why that is happening) though as the first one was giving me a parsing  
> error. Is there any way to to a multi-term query with the URI format  
> with something like: q=term:value, term2=value2&size=100 or is that  
> not possible? I'm new to this, so getting a good grasp on the syntax  
> is still an issue.
> 
> On Jun 25, 5:47 pm, Shay Banon \<[shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) ([http://elasticsearch.com](http://elasticsearch.com))\> wrote:
> 
> > The first curl looks good, do you get total\_hits that is higher then 10, and you say you only get 10 back? Can you gist a repro in this case? The second curl is wrong since size is another parameter, and should be separated using & from the q parameter.
> > 
> > On Saturday, June 25, 2011 at 11:00 PM, Josh JRG wrote:
> > 
> > > The size parameter isn't working on either a query based or uri  
> > > search. "hits" will give me the correct number or results (say,  
> > > something like 27), but I still only get the first 10 results.
> > 
> > > I'm using the following:
> > 
> > > curl -XGET '[http://localhost:9200/indexname/indextype/\_search'-d](http://localhost:9200/indexname/indextype/_search'-d) '{  
> > > "from" : 0, "size" : 100,  
> > > "query" : {  
> > > "terms" : {  
> > > "term1" : "value1",  
> > > "term2" : "value2"  
> > > }  
> > > }  
> > > }
> > 
> > > OR
> > 
> > > curl -XGET '[http://localhost:9200/indexname/indextype/\_search](http://localhost:9200/indexname/indextype/_search)?  
> > > q=term:value,size=100'
> > 
> > > Any ideas or help would be very much appreciated.

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [June 26, 2011, 10:20am UTC](https://discuss.elastic.co/t/size-parameter-isnt-working/4707/5 "2011-06-26T10:20:45Z")

</div>

Hi Josh

> I'm using the following:
> 
> curl -XGET '[http://localhost:9200/indexname/indextype/\_search](http://localhost:9200/indexname/indextype/_search)' -d '{  
> "from" : 0, "size" : 100,  
> "query" : {  
> "terms" : {  
> "term1" : "value1",  
> "term2" : "value2"  
> }  
> }  
> }

The problem is not with the size parameter, but with your query:

Try this instead:

curl -XGET '[http://127.0.0.1:9200/indexname/indextype/\_search?pretty=1](http://127.0.0.1:9200/indexname/indextype/_search?pretty=1)' -d '  
{  
"from" : 0,  
"query" : {  
"bool" : {  
"must" : [  
{  
"text" : {  
"term1" : "value1"  
}  
},  
{  
"text" : {  
"term2" : "value2"  
}  
}  
]  
}  
},  
"size" : 100  
}  
'

Note: I have used a 'text' query instead of a 'term' query, because a  
term query is probably not what you are after. Term queries only match  
if exactly the same term is stored in your database, eg "Foo" won't  
match "foo".

If you haven't actually specified {index: "not\_analyzed"} on your term1  
and term2 fields, then they are probably set to be analyzed (ie treated  
as full text, not discrete terms).

Either way, the 'text' query will do the right thing: if the field is  
analyzed, then it will treat it as a full text search, and if it is  
not\_analyzed, then it will do a term query instead.

clint

---

<div class="post-metadata">

**Author:** ![Josh\_JRG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/josh_jrg/32/3113_2.png) [@Josh\_JRG](https://discuss.elastic.co/u/Josh_JRG)\
**Post date:** [June 26, 2011, 2:43pm UTC](https://discuss.elastic.co/t/size-parameter-isnt-working/4707/6 "2011-06-26T14:43:21Z")

</div>

Yes, I'm trying to query several fields. I've got several vignettes,  
each with a defined set of metadata indexed in ES and I'm trying to  
query one or more of those common fields, so yes I was to do  
field:value. I think Clint may have provided me with an answer. I'll  
try out what you guys have suggested and come back with results.  
Thanks.

On Jun 26, 5:36 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Yes, your first curl is not correct when it comes to the query structure. What do you mean by doing a query like term:value? You mean field:value? You want to query several fields?
> 
> On Sunday, June 26, 2011 at 4:46 AM, Josh JRG wrote:
> 
> > Actually, the first curl causes elasticsearch to throw an "unable to  
> > parse" error. Am I improperly constructing a multi-term query? Is my  
> > syntax wrong? Yes, total\_hits comes back as a number higher than 10 (I  
> > believe it was 14 in my example), but the number of matching records  
> > being returned is still only 10. I'm unable to post a repro from my  
> > current location, but I will be able to tomorrow morning. I believe  
> > that was primarily occurring on my second curl (and you've explained  
> > why that is happening) though as the first one was giving me a parsing  
> > error. Is there any way to to a multi-term query with the URI format  
> > with something like: q=term:value, term2=value2&size=100 or is that  
> > not possible? I'm new to this, so getting a good grasp on the syntax  
> > is still an issue.
> 
> > On Jun 25, 5:47 pm, Shay Banon \<[shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) ([http://elasticsearch.com](http://elasticsearch.com))\> wrote:
> > 
> > > The first curl looks good, do you get total\_hits that is higher then 10, and you say you only get 10 back? Can you gist a repro in this case? The second curl is wrong since size is another parameter, and should be separated using & from the q parameter.
> 
> > > On Saturday, June 25, 2011 at 11:00 PM, Josh JRG wrote:
> > > 
> > > > The size parameter isn't working on either a query based or uri  
> > > > search. "hits" will give me the correct number or results (say,  
> > > > something like 27), but I still only get the first 10 results.
> 
> > > > I'm using the following:
> 
> > > > curl -XGET '[http://localhost:9200/indexname/indextype/\_search'-d'](http://localhost:9200/indexname/indextype/_search'-d'){  
> > > > "from" : 0, "size" : 100,  
> > > > "query" : {  
> > > > "terms" : {  
> > > > "term1" : "value1",  
> > > > "term2" : "value2"  
> > > > }  
> > > > }  
> > > > }
> 
> > > > OR
> 
> > > > curl -XGET '[http://localhost:9200/indexname/indextype/\_search](http://localhost:9200/indexname/indextype/_search)?  
> > > > q=term:value,size=100'
> 
> > > > Any ideas or help would be very much appreciated.

---

<div class="post-metadata">

**Author:** ![Josh\_JRG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/josh_jrg/32/3113_2.png) [@Josh\_JRG](https://discuss.elastic.co/u/Josh_JRG)\
**Post date:** [June 26, 2011, 3:29pm UTC](https://discuss.elastic.co/t/size-parameter-isnt-working/4707/7 "2011-06-26T15:29:30Z")

</div>

The text query actually didn't work. I'm looking to exactly match two  
or more field : value pairs I know to be present in at least one of my  
indexed items and a text search gives me back 0 hits.

Here's what I used:

curl -XGET '[http://127.0.0.1:9200/mindseye/vignette/\_search](http://127.0.0.1:9200/mindseye/vignette/_search)' -d '{  
"from" : 0, "size" : 100,  
"query" : {  
"bool : {  
"must" : [  
{ "text" : { "bucket" : "minds-eye-vignette-repository" } },  
{ "text" : { "setting" : "urban9" } }  
]  
}  
}  
}'

As I said, I know that that combination should give me back at least 2  
hits, but I'm currently getting nothing.

On Jun 26, 6:20 am, Clinton Gormley [clin...@iannounce.co.uk](mailto:clin...@iannounce.co.uk) wrote:

> Hi Josh
> 
> > I'm using the following:
> 
> > curl -XGET '[http://localhost:9200/indexname/indextype/\_search'-d](http://localhost:9200/indexname/indextype/_search'-d) '{  
> > "from" : 0, "size" : 100,  
> > "query" : {  
> > "terms" : {  
> > "term1" : "value1",  
> > "term2" : "value2"  
> > }  
> > }  
> > }
> 
> The problem is not with the size parameter, but with your query:
> 
> Try this instead:
> 
> curl -XGET '[http://127.0.0.1:9200/indexname/indextype/\_search?pretty=1](http://127.0.0.1:9200/indexname/indextype/_search?pretty=1)' -d '  
> {  
> "from" : 0,  
> "query" : {  
> "bool" : {  
> "must" : [  
> {  
> "text" : {  
> "term1" : "value1"  
> }  
> },  
> {  
> "text" : {  
> "term2" : "value2"  
> }  
> }  
> ]  
> }  
> },  
> "size" : 100}
> 
> '
> 
> Note: I have used a 'text' query instead of a 'term' query, because a  
> term query is probably not what you are after. Term queries only match  
> if exactly the same term is stored in your database, eg "Foo" won't  
> match "foo".
> 
> If you haven't actually specified {index: "not\_analyzed"} on your term1  
> and term2 fields, then they are probably set to be analyzed (ie treated  
> as full text, not discrete terms).
> 
> Either way, the 'text' query will do the right thing: if the field is  
> analyzed, then it will treat it as a full text search, and if it is  
> not\_analyzed, then it will do a term query instead.
> 
> clint

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [June 26, 2011, 3:39pm UTC](https://discuss.elastic.co/t/size-parameter-isnt-working/4707/8 "2011-06-26T15:39:24Z")

</div>

On Sun, 2011-06-26 at 08:29 -0700, Josh JRG wrote:

> The text query actually didn't work. I'm looking to exactly match two  
> or more field : value pairs I know to be present in at least one of my  
> indexed items and a text search gives me back 0 hits.
> 
> Here's what I used:
> 
> curl -XGET '[http://127.0.0.1:9200/mindseye/vignette/\_search](http://127.0.0.1:9200/mindseye/vignette/_search)' -d '{  
> "from" : 0, "size" : 100,  
> "query" : {  
> "bool : {  
> "must" : [  
> { "text" : { "bucket" : "minds-eye-vignette-repository" } },  
> { "text" : { "setting" : "urban9" } }  
> ]  
> }  
> }  
> }'
> 
> As I said, I know that that combination should give me back at least 2  
> hits, but I'm currently getting nothing.

I assume that in your actual test you quote "bool" correctly?

I suggest that you gist (see [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help) ) a  
complete recreation of what you're doing, otherwise it is difficult to  
figure out where you are going wrong

clint

---

<div class="post-metadata">

**Author:** ![Josh\_JRG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/josh_jrg/32/3113_2.png) [@Josh\_JRG](https://discuss.elastic.co/u/Josh_JRG)\
**Post date:** [June 26, 2011, 5:55pm UTC](https://discuss.elastic.co/t/size-parameter-isnt-working/4707/9 "2011-06-26T17:55:00Z")

</div>

Nevermind, there was a copy and paste error (not the end quote on  
bool) that I kept replicating. The multi-field text search seems to  
work perfectly. Thanks Clint. I am very grateful for your help.

On Jun 26, 11:39 am, Clinton Gormley [clin...@iannounce.co.uk](mailto:clin...@iannounce.co.uk) wrote:

> On Sun, 2011-06-26 at 08:29 -0700, Josh JRG wrote:
> 
> > The text query actually didn't work. I'm looking to exactly match two  
> > or more field : value pairs I know to be present in at least one of my  
> > indexed items and a text search gives me back 0 hits.
> 
> > Here's what I used:
> 
> > curl -XGET '[http://127.0.0.1:9200/mindseye/vignette/\_search'-d](http://127.0.0.1:9200/mindseye/vignette/_search'-d) '{  
> > "from" : 0, "size" : 100,  
> > "query" : {  
> > "bool : {  
> > "must" : [  
> > { "text" : { "bucket" : "minds-eye-vignette-repository" } },  
> > { "text" : { "setting" : "urban9" } }  
> > ]  
> > }  
> > }  
> > }'
> 
> > As I said, I know that that combination should give me back at least 2  
> > hits, but I'm currently getting nothing.
> 
> I assume that in your actual test you quote "bool" correctly?
> 
> I suggest that you gist (seehttp://www.elasticsearch.org/help) a  
> complete recreation of what you're doing, otherwise it is difficult to  
> figure out where you are going wrong
> 
> clint

---

<div class="post-metadata">

**Author:** ![Josh\_JRG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/josh_jrg/32/3113_2.png) [@Josh\_JRG](https://discuss.elastic.co/u/Josh_JRG)\
**Post date:** [June 26, 2011, 6:48pm UTC](https://discuss.elastic.co/t/size-parameter-isnt-working/4707/10 "2011-06-26T18:48:58Z")

</div>

Thanks to you too Shay.

On Jun 26, 5:36 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Yes, your first curl is not correct when it comes to the query structure. What do you mean by doing a query like term:value? You mean field:value? You want to query several fields?
> 
> On Sunday, June 26, 2011 at 4:46 AM, Josh JRG wrote:
> 
> > Actually, the first curl causes elasticsearch to throw an "unable to  
> > parse" error. Am I improperly constructing a multi-term query? Is my  
> > syntax wrong? Yes, total\_hits comes back as a number higher than 10 (I  
> > believe it was 14 in my example), but the number of matching records  
> > being returned is still only 10. I'm unable to post a repro from my  
> > current location, but I will be able to tomorrow morning. I believe  
> > that was primarily occurring on my second curl (and you've explained  
> > why that is happening) though as the first one was giving me a parsing  
> > error. Is there any way to to a multi-term query with the URI format  
> > with something like: q=term:value, term2=value2&size=100 or is that  
> > not possible? I'm new to this, so getting a good grasp on the syntax  
> > is still an issue.
> 
> > On Jun 25, 5:47 pm, Shay Banon \<[shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) ([http://elasticsearch.com](http://elasticsearch.com))\> wrote:
> > 
> > > The first curl looks good, do you get total\_hits that is higher then 10, and you say you only get 10 back? Can you gist a repro in this case? The second curl is wrong since size is another parameter, and should be separated using & from the q parameter.
> 
> > > On Saturday, June 25, 2011 at 11:00 PM, Josh JRG wrote:
> > > 
> > > > The size parameter isn't working on either a query based or uri  
> > > > search. "hits" will give me the correct number or results (say,  
> > > > something like 27), but I still only get the first 10 results.
> 
> > > > I'm using the following:
> 
> > > > curl -XGET '[http://localhost:9200/indexname/indextype/\_search'-d'](http://localhost:9200/indexname/indextype/_search'-d'){  
> > > > "from" : 0, "size" : 100,  
> > > > "query" : {  
> > > > "terms" : {  
> > > > "term1" : "value1",  
> > > > "term2" : "value2"  
> > > > }  
> > > > }  
> > > > }
> 
> > > > OR
> 
> > > > curl -XGET '[http://localhost:9200/indexname/indextype/\_search](http://localhost:9200/indexname/indextype/_search)?  
> > > > q=term:value,size=100'
> 
> > > > Any ideas or help would be very much appreciated.

---

<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:02am UTC](https://discuss.elastic.co/t/size-parameter-isnt-working/4707/11 "2017-07-06T04:02:34Z")

</div>


