_count vs. filter facet

Hello Group,

Could someone please explain to me the difference between the
*
_count interface *vs.the filter facet

From the elasticsearch documentation:

Filter facet:
"A filter facet (not to be confused with a facet filter) allows you to
return a count of the hits matching the filter."

Count API:
"The count API allows to easily execute a query and get the number of
matches for that query"

Essentially, would I get the same results for a given query, i.e. a count
of matching documents?

If not, what is the actual difference (operation-wise and results).

Thank you!

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Chris,

These two different beasts.

A _count allows to quickly get the number of documents matching a single
but arbitrary query. Important to note here that queries are not the same
as filters. Filters are similar in nature to queries but do not involve
scoring and sorting and thus are limited in functionality but tend to be
faster.

A fiter facet indeed gives a count of document matching a filter but
because it is a facet (rather than an endpoint like _count) it is a
completely different type of a lego block. It is a part of a search request
and the number it gives the number of document that match the filter AND
the documents that match the query of the search. Because it is a part of a
search request, you can have multiple (filter) facet in one request. Using
multiple facets gives a counting analysis for multiple subsets the results.
This is especially more efficient if the main query is heavy and the
filters you use in the facets are cached.

Hope this clarifies things a bit.

Boaz

On Tuesday, May 7, 2013 9:32:38 AM UTC+2, Chris Kinsalb wrote:

Hello Group,

Could someone please explain to me the difference between the
*
_count interface *vs.the filter facet

From the elasticsearch documentation:

Filter facet:
"A filter facet (not to be confused with a facet filter) allows you to
return a count of the hits matching the filter."

Count API:
"The count API allows to easily execute a query and get the number of
matches for that query"

Essentially, would I get the same results for a given query, i.e. a count
of matching documents?

If not, what is the actual difference (operation-wise and results).

Thank you!

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hello Boaz,

thanks for the clarification!

On Wednesday, May 15, 2013 5:27:34 PM UTC+2, Boaz Leskes wrote:

Hi Chris,

These two different beasts.

A _count allows to quickly get the number of documents matching a single
but arbitrary query. Important to note here that queries are not the same
as filters. Filters are similar in nature to queries but do not involve
scoring and sorting and thus are limited in functionality but tend to be
faster.

A fiter facet indeed gives a count of document matching a filter but
because it is a facet (rather than an endpoint like _count) it is a
completely different type of a lego block. It is a part of a search request
and the number it gives the number of document that match the filter AND
the documents that match the query of the search. Because it is a part of a
search request, you can have multiple (filter) facet in one request. Using
multiple facets gives a counting analysis for multiple subsets the results.
This is especially more efficient if the main query is heavy and the
filters you use in the facets are cached.

Hope this clarifies things a bit.

Boaz

On Tuesday, May 7, 2013 9:32:38 AM UTC+2, Chris Kinsalb wrote:

Hello Group,

Could someone please explain to me the difference between the
*
_count interface *vs.the filter facet

From the elasticsearch documentation:

Filter facet:
"A filter facet (not to be confused with a facet filter) allows you to
return a count of the hits matching the filter."

Count API:
"The count API allows to easily execute a query and get the number of
matches for that query"

Essentially, would I get the same results for a given query, i.e. a count
of matching documents?

If not, what is the actual difference (operation-wise and results).

Thank you!

--
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.
For more options, visit https://groups.google.com/groups/opt_out.