# Confused about search/count queries

**URL:** <https://discuss.elastic.co/t/confused-about-search-count-queries/11418>\
**Category:** Elasticsearch\
**Created:** [April 2, 2013, 5:48pm UTC](https://discuss.elastic.co/t/confused-about-search-count-queries/11418 "2013-04-02T17:48:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tiglath](https://avatars.discourse-cdn.com/v4/letter/t/df705f/32.png) [@Tiglath](https://discuss.elastic.co/u/Tiglath)\
**Post date:** [April 2, 2013, 5:48pm UTC](https://discuss.elastic.co/t/confused-about-search-count-queries/11418/1 "2013-04-02T17:48:39Z")

</div>

I am taking ES training in NY later this month, but I sort of need to  
know this before then.

I have index 'asset' of type 'ip'. Running ES 0.19.10

The query:

curl -XGET '[http://localhost:9200/asset/ip/\_search](http://localhost:9200/asset/ip/_search)' -d '{  
"query" : {  
"query\_string" : {  
"query" : "continent:EU"  
}  
}  
}'

works fine but if instead of \_search I use \_count, it gives me an  
exception.

"QueryParsingException[[asset] No query registered for [query]]"

If I change the request body, however, to:

```
 '{
      "query_string" : {
          "query" :"continent:EU"
      }
 }'

```

\_count works.

What am I missing?

Thanks

--  
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:** [April 3, 2013, 2:21pm UTC](https://discuss.elastic.co/t/confused-about-search-count-queries/11418/2 "2013-04-03T14:21:01Z")

</div>

> }'
> 
> works fine but if instead of \_search I use \_count, it gives me an  
> exception.
> 
> "QueryParsingException[[asset] No query registered for [query]]"
> 
> If I change the request body, however, to:
> 
> ```
> '{
> "query_string" : {
> "query" :"continent:EU"
> }
> }'
> 
> ```
> 
> \_count works.

> What am I missing?

Only that the \_search and \_count APIs are different. The search API  
takes various parameters, so you have to specify which is the query with  
a parameter called "query".

The count API just takes a query, so the whole request body IS the  
query.

clint

--  
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:43am UTC](https://discuss.elastic.co/t/confused-about-search-count-queries/11418/3 "2017-07-06T02:43:01Z")

</div>


