Count versus Search API

Hello,

I have a bool query with a filter applied to it, which runs against the
_search endpoint successfully giving "hits.total" but unfortunately it also
gives a lot more data than that which I don't need.

So I thought of running the same query against the _count endpoint but
there I received a
failure: "BroadcastShardOperationFailedException[[index_test][0] ]; nested:
QueryParsingException[[index_test] No query registered for [query]]; "

Is there some other lightweight manner in which I can get just "hits.total"
without the added bloat of each matching doc?

Thanks!

  • Pulkit

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/a1c1e381-3464-4932-8114-977b2e01c304%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

How does your count query look like?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 24 févr. 2014 à 04:51, pulkitsinghal pulkitsinghal@gmail.com a écrit :

Hello,

I have a bool query with a filter applied to it, which runs against the _search endpoint successfully giving "hits.total" but unfortunately it also gives a lot more data than that which I don't need.

So I thought of running the same query against the _count endpoint but there I received a failure: "BroadcastShardOperationFailedException[[index_test][0] ]; nested: QueryParsingException[[index_test] No query registered for [query]]; "

Is there some other lightweight manner in which I can get just "hits.total" without the added bloat of each matching doc?

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/C9753722-16FB-4005-B332-CECE3FED6DF2%40pilato.fr.
For more options, visit https://groups.google.com/groups/opt_out.

I guess you are still on 0.90, where the count request is slightly
different compared to a search request, as it contains the query without it
being wrapped into the query object:

{
"term" : {"field":"value"}
}

instead of

{
"query" : {
"term" : {"field":"value"}
}
}

Beware that we changed this in 1.0 to have consistency between count api
and search api.

On Monday, February 24, 2014 4:51:43 AM UTC+1, pulkitsinghal wrote:

Hello,

I have a bool query with a filter applied to it, which runs against the
_search endpoint successfully giving "hits.total" but unfortunately it also
gives a lot more data than that which I don't need.

So I thought of running the same query against the _count endpoint but
there I received a
failure: "BroadcastShardOperationFailedException[[index_test][0] ]; nested:
QueryParsingException[[index_test] No query registered for [query]]; "

Is there some other lightweight manner in which I can get just
"hits.total" without the added bloat of each matching doc?

Thanks!

  • Pulkit

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/6d7827db-af6e-4f5e-a394-bfb09652be7a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hey @David, since Luca had zeroed-in-on the issue, I'll skip providing the
query this time.

@Luca - Thanks! That was exactly the problem! Another thing that is
inconsistent right now is that I can use date math against the _search
endpoint for filters but not against the _count endpoint in 0.90:
"lt" : "now",
"gte" : "now-1w"
versus:
"lt" : "2014-02-24",
"gte" : "2014-02-17"

On Mon, Feb 24, 2014 at 1:38 AM, Luca Cavanna cavannaluca@gmail.com wrote:

I guess you are still on 0.90, where the count request is slightly
different compared to a search request, as it contains the query without it
being wrapped into the query object:

{
"term" : {"field":"value"}
}

instead of

{
"query" : {
"term" : {"field":"value"}
}
}

Beware that we changed this in 1.0 to have consistency between count api
and search api.

On Monday, February 24, 2014 4:51:43 AM UTC+1, pulkitsinghal wrote:

Hello,

I have a bool query with a filter applied to it, which runs against the
_search endpoint successfully giving "hits.total" but unfortunately it also
gives a lot more data than that which I don't need.

So I thought of running the same query against the _count endpoint but
there I received a failure: "BroadcastShardOperationFailedException[[index_test][0]
]; nested: QueryParsingException[[index_test] No query registered for
[query]]; "

Is there some other lightweight manner in which I can get just
"hits.total" without the added bloat of each matching doc?

Thanks!

  • Pulkit

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/6d7827db-af6e-4f5e-a394-bfb09652be7a%40googlegroups.com
.

For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CADA%3DEV807-Us2vVqcf8vbif-1Mxsx4rGtV8nn%3D0KyX_tWJYLaA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.