# Querying elasicsearch with REST Client

**URL:** <https://discuss.elastic.co/t/querying-elasicsearch-with-rest-client/10712>\
**Category:** Elasticsearch\
**Created:** [February 12, 2013, 2:46pm UTC](https://discuss.elastic.co/t/querying-elasicsearch-with-rest-client/10712 "2013-02-12T14:46:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ophir\_Michaeli](https://avatars.discourse-cdn.com/v4/letter/o/9f8e36/32.png) [@Ophir\_Michaeli](https://discuss.elastic.co/u/Ophir_Michaeli)\
**Post date:** [February 12, 2013, 2:46pm UTC](https://discuss.elastic.co/t/querying-elasicsearch-with-rest-client/10712/1 "2013-02-12T14:46:36Z")

</div>

Hi,

I'm trying to search with REST Client and while the http requests are  
working OK, when I add a Body query it ignores the query.

For example -

URL(http request):

_[http://localhost:9200/cinemagramcin/documents/\_search](http://localhost:9200/cinemagramcin/documents/_search)_[http://localhost:9200/cinemagramcin/documents/\_search](http://localhost:9200/cinemagramcin/documents/_search)

Body:

{

```
"from" : 0, "size" : 20,

"query" : {

    "term" : { "description" : "kids" }

}

```

}

Is REST Client the right tool to use?

Thanks,

Ophir

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [February 12, 2013, 3:04pm UTC](https://discuss.elastic.co/t/querying-elasicsearch-with-rest-client/10712/2 "2013-02-12T15:04:17Z")

</div>

Hiya

> I'm trying to search with REST Client and while the http requests are  
> working OK, when I add a Body query it ignores the query.

Javascript doesn't do GET requests with a body. You can use a POST  
request instead

clint

> For example -
> 
> URL(http request):
> 
> [http://localhost:9200/cinemagramcin/documents/\_search](http://localhost:9200/cinemagramcin/documents/_search)
> 
> Body:
> 
> {
> 
> ```
> "from" : 0, "size" : 20,
> 
> "query" : {
> 
> "term" : { "description" : "kids" }
> 
> }
> 
> ```
> 
> }
> 
> Is REST Client the right tool to use?
> 
> Thanks,
> 
> Ophir
> 
> --  
> 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![mattweber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattweber/32/44940_2.png) [@mattweber](https://discuss.elastic.co/u/mattweber)\
**Post date:** [February 12, 2013, 7:55pm UTC](https://discuss.elastic.co/t/querying-elasicsearch-with-rest-client/10712/3 "2013-02-12T19:55:01Z")

</div>

If you are using javascript you might want to checkout Elastic.js...

> **[GitHub - fullscale/elastic.js: A JavaScript implementation of the...](https://github.com/fullscale/elastic.js)**
>
> A JavaScript implementation of the elasticsearch Query DSL - GitHub - fullscale/elastic.js: A JavaScript implementation of the elasticsearch Query DSL

Thanks,  
Matt Weber

On Tue, Feb 12, 2013 at 7:04 AM, Clinton Gormley [clint@traveljury.com](mailto:clint@traveljury.com) wrote:

> Hiya
> 
> > I'm trying to search with REST Client and while the http requests are  
> > working OK, when I add a Body query it ignores the query.
> 
> Javascript doesn't do GET requests with a body. You can use a POST  
> request instead
> 
> clint
> 
> > For example -
> > 
> > URL(http request):
> > 
> > [http://localhost:9200/cinemagramcin/documents/\_search](http://localhost:9200/cinemagramcin/documents/_search)
> > 
> > Body:
> > 
> > {
> > 
> > ```
> > "from" : 0, "size" : 20,
> > 
> > "query" : {
> > 
> > "term" : { "description" : "kids" }
> > 
> > }
> > 
> > ```
> > 
> > }
> > 
> > Is REST Client the right tool to use?
> > 
> > Thanks,
> > 
> > Ophir
> > 
> > --  
> > 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:51am UTC](https://discuss.elastic.co/t/querying-elasicsearch-with-rest-client/10712/4 "2017-07-06T02:51:50Z")

</div>


