# Count and Search API status codes are inconsistent

**URL:** <https://discuss.elastic.co/t/count-and-search-api-status-codes-are-inconsistent/13335>\
**Category:** Elasticsearch\
**Created:** [August 26, 2013, 9:36pm UTC](https://discuss.elastic.co/t/count-and-search-api-status-codes-are-inconsistent/13335 "2013-08-26T21:36:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Garron\_Moore](https://avatars.discourse-cdn.com/v4/letter/g/3be4f8/32.png) [@Garron\_Moore](https://discuss.elastic.co/u/Garron_Moore)\
**Post date:** [August 26, 2013, 9:36pm UTC](https://discuss.elastic.co/t/count-and-search-api-status-codes-are-inconsistent/13335/1 "2013-08-26T21:36:56Z")

</div>

I'm not sure if this query is valid or not, but regardless, I'm getting a  
400 from the search api and a 200 from the count API. It seems like they  
should be consistent.

> <https://gist.github.com/garron/6346888>

The output from this gist is:

{"ok":true,"\_index":"myindex","\_type":"mydoc","\_id":"5kngTmpeR5GtJg6Vu46tUw","\_version":1}\n  
Count using a good query  
200  
Search using a good query  
200  
Count using a bad query  
200  
Search using a bad query  
400

If you take out the "-o /dev/null", you can see that both the search and  
count produce errors in the "bad query" case, but the count API still  
returns a 200.

On a related note, is it expected that putting "\*field\_name:field\_value" in  
a query string should produce a parse exception?

--  
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:** ![Boaz\_Leskes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/boaz_leskes/32/723_2.png) [@Boaz\_Leskes](https://discuss.elastic.co/u/Boaz_Leskes)\
**Post date:** [August 27, 2013, 7:34am UTC](https://discuss.elastic.co/t/count-and-search-api-status-codes-are-inconsistent/13335/2 "2013-08-27T07:34:43Z")

</div>

Hi Garron,

I can confirm that this is indeed inconsistent. Can you please open an  
issue on [Issues · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues) ?

You can read more about the lucene query syntax  
here: [org.apache.lucene.queryparser.classic (Lucene 4.4.0 API)](http://lucene.apache.org/core/4_4_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html)

Cheers,  
Boaz

On Monday, August 26, 2013 11:36:56 PM UTC+2, Garron Moore wrote:

> I'm not sure if this query is valid or not, but regardless, I'm getting a  
> 400 from the search api and a 200 from the count API. It seems like they  
> should be consistent.
> 
> [Count and search status codes are inconsistent · GitHub](https://gist.github.com/garron/6346888)
> 
> The output from this gist is:
> 
> {"ok":true,"\_index":"myindex","\_type":"mydoc","\_id":"5kngTmpeR5GtJg6Vu46tUw","\_version":1}\n  
> Count using a good query  
> 200  
> Search using a good query  
> 200  
> Count using a bad query  
> 200  
> Search using a bad query  
> 400
> 
> If you take out the "-o /dev/null", you can see that both the search and  
> count produce errors in the "bad query" case, but the count API still  
> returns a 200.
> 
> On a related note, is it expected that putting "\*field\_name:field\_value"  
> in a query string should produce a parse exception?

--  
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:** ![Garron\_Moore](https://avatars.discourse-cdn.com/v4/letter/g/3be4f8/32.png) [@Garron\_Moore](https://discuss.elastic.co/u/Garron_Moore)\
**Post date:** [August 27, 2013, 4:50pm UTC](https://discuss.elastic.co/t/count-and-search-api-status-codes-are-inconsistent/13335/3 "2013-08-27T16:50:29Z")

</div>

Thanks. I've written  
up [Count and Search API status codes are inconsistent (count does not return 400) · Issue #3585 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/3585)

Garron

On Tuesday, August 27, 2013 12:34:43 AM UTC-7, Boaz Leskes wrote:

> Hi Garron,
> 
> I can confirm that this is indeed inconsistent. Can you please open an  
> issue on [Issues · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues) ?
> 
> You can read more about the lucene query syntax here:  
> [org.apache.lucene.queryparser.classic (Lucene 4.4.0 API)](http://lucene.apache.org/core/4_4_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html)
> 
> Cheers,  
> Boaz
> 
> On Monday, August 26, 2013 11:36:56 PM UTC+2, Garron Moore wrote:
> 
> > I'm not sure if this query is valid or not, but regardless, I'm getting a  
> > 400 from the search api and a 200 from the count API. It seems like they  
> > should be consistent.
> > 
> > [Count and search status codes are inconsistent · GitHub](https://gist.github.com/garron/6346888)
> > 
> > The output from this gist is:
> > 
> > {"ok":true,"\_index":"myindex","\_type":"mydoc","\_id":"5kngTmpeR5GtJg6Vu46tUw","\_version":1}\n  
> > Count using a good query  
> > 200  
> > Search using a good query  
> > 200  
> > Count using a bad query  
> > 200  
> > Search using a bad query  
> > 400
> > 
> > If you take out the "-o /dev/null", you can see that both the search and  
> > count produce errors in the "bad query" case, but the count API still  
> > returns a 200.
> > 
> > On a related note, is it expected that putting "\*field\_name:field\_value"  
> > in a query string should produce a parse exception?

--  
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:19am UTC](https://discuss.elastic.co/t/count-and-search-api-status-codes-are-inconsistent/13335/4 "2017-07-06T02:19:29Z")

</div>


