Term aggregation/facet NOT INCLUDING the faceted field


(adam.porat@gmail.com) #1

Hi,

Faceted Navigation, as can be seen in *LinkedIn *and *Booking.com*, 

include the fundamental characteristic that the value-count of each faceted
field is constrained by the query (set of matched documents), *excluding *any
constraint on the given field itself.

For example, in LinkedIn, If the "locations" facet is currently 

filtered with "Canada" (the "Canada" check-box is selected), the facet will
still include counts for the other locations.

It seems that Elasticsearch lacks the feature to count the terms in the 

set of matched documents, AS IF the faceted field itself was not a part of
the query. Am I correct?

And thus, if I have *n* faceted fields in my faceted navigation, each 

clicked checkbox involves executing n separate queries - one to modify
the actual result set, and n-1 to rebuild the other facets (each one with
a query which excludes its field).

 Did I get this right? any better ways to do this?

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/89ecc3ed-2d58-4253-b0d1-a7d12495c89d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(David Pilato) #2

In that case, you should look at post filters instead of adding filters to the query.

My 2 cents

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

Le 29 juil. 2014 à 11:32, Adam Porat adam.porat@gmail.com a écrit :

Hi,

Faceted Navigation, as can be seen in LinkedIn and Booking.com, include the fundamental characteristic that the value-count of each faceted field is constrained by the query (set of matched documents), excluding any constraint on the given field itself.

For example, in LinkedIn, If the "locations" facet is currently filtered with "Canada" (the "Canada" check-box is selected), the facet will still include counts for the other locations.

It seems that Elasticsearch lacks the feature to count the terms in the set of matched documents, AS IF the faceted field itself was not a part of the query. Am I correct?

And thus, if I have n faceted fields in my faceted navigation, each clicked checkbox involves executing n separate queries - one to modify the actual result set, and n-1 to rebuild the other facets (each one with a query which excludes its field).

 Did I get this right? any better ways to do this?

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/89ecc3ed-2d58-4253-b0d1-a7d12495c89d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/50A5A6FC-FDFC-4C69-9E32-1F9B33FC127C%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.


(Adrien Grand) #3

Hi Adam, you can do it today in a single query using post_filter, but it is
true that it is not very convenient. See discussion on
https://github.com/elasticsearch/elasticsearch/pull/7020 for more
information.

On Tue, Jul 29, 2014 at 11:32 AM, Adam Porat adam.porat@gmail.com wrote:

Hi,

Faceted Navigation, as can be seen in *LinkedIn *and *Booking.com*,

include the fundamental characteristic that the value-count of each faceted
field is constrained by the query (set of matched documents), *excluding *any
constraint on the given field itself.

For example, in LinkedIn, If the "locations" facet is currently

filtered with "Canada" (the "Canada" check-box is selected), the facet will
still include counts for the other locations.

It seems that Elasticsearch lacks the feature to count the terms in

the set of matched documents, AS IF the faceted field itself was not a part
of the query. Am I correct?

And thus, if I have *n* faceted fields in my faceted navigation, each

clicked checkbox involves executing n separate queries - one to modify
the actual result set, and n-1 to rebuild the other facets (each one
with a query which excludes its field).

 Did I get this right? any better ways to do this?

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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/89ecc3ed-2d58-4253-b0d1-a7d12495c89d%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/89ecc3ed-2d58-4253-b0d1-a7d12495c89d%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
Adrien Grand

--
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/CAL6Z4j7v075s0C9uLaOSDzWVFF_B%3Dp0BequyCr3ooAC1Vwp-wA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(adam.porat@gmail.com) #4

Hi David,
post filter could have been a solution for single faceted-field
scenario. However each facet in a multi-facet scenario needs to be affected
by constraints on the other faceted-fields.

בתאריך יום שלישי, 29 ביולי 2014 12:40:24 UTC+3, מאת David Pilato:

In that case, you should look at post filters instead of adding filters to
the query.

My 2 cents

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

Le 29 juil. 2014 à 11:32, Adam Porat <adam....@gmail.com <javascript:>> a
écrit :

Hi,

Faceted Navigation, as can be seen in *LinkedIn *and *Booking.com 

http://Booking.com*, include the fundamental characteristic that the
value-count of each faceted field is constrained by the query (set of
matched documents), *excluding *any constraint on the given field itself.

For example, in LinkedIn, If the "locations" facet is currently 

filtered with "Canada" (the "Canada" check-box is selected), the facet will
still include counts for the other locations.

It seems that Elasticsearch lacks the feature to count the terms in 

the set of matched documents, AS IF the faceted field itself was not a part
of the query. Am I correct?

And thus, if I have *n* faceted fields in my faceted navigation, each 

clicked checkbox involves executing n separate queries - one to modify
the actual result set, and n-1 to rebuild the other facets (each one
with a query which excludes its field).

 Did I get this right? any better ways to do this?

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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/89ecc3ed-2d58-4253-b0d1-a7d12495c89d%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/89ecc3ed-2d58-4253-b0d1-a7d12495c89d%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/05489778-c3f1-42ff-922d-8a3175be17dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(adam.porat@gmail.com) #5

Hi Adrien, it looks like your link gives the best answer, basically use the
construct:

{
"query": {
"filtered": {
"query": "your query goes here",
"filter": "filters to take into account for top-hits and aggs"
}
},
"post_filter" : "filters to take into account for top-hits only",
"aggs": {
"my_filter": {
"filter": "filter to take into account for aggs only"
}
}}

בתאריך יום שלישי, 29 ביולי 2014 12:42:13 UTC+3, מאת Adrien Grand:

Hi Adam, you can do it today in a single query using post_filter, but it
is true that it is not very convenient. See discussion on
https://github.com/elasticsearch/elasticsearch/pull/7020 for more
information.

On Tue, Jul 29, 2014 at 11:32 AM, Adam Porat <adam....@gmail.com
<javascript:>> wrote:

Hi,

Faceted Navigation, as can be seen in *LinkedIn *and *Booking.com*, 

include the fundamental characteristic that the value-count of each faceted
field is constrained by the query (set of matched documents), *excluding
*any constraint on the given field itself.

For example, in LinkedIn, If the "locations" facet is currently 

filtered with "Canada" (the "Canada" check-box is selected), the facet will
still include counts for the other locations.

It seems that Elasticsearch lacks the feature to count the terms in 

the set of matched documents, AS IF the faceted field itself was not a part
of the query. Am I correct?

And thus, if I have *n* faceted fields in my faceted navigation, 

each clicked checkbox involves executing n separate queries - one to
modify the actual result set, and n-1 to rebuild the other facets
(each one with a query which excludes its field).

 Did I get this right? any better ways to do this?

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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/89ecc3ed-2d58-4253-b0d1-a7d12495c89d%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/89ecc3ed-2d58-4253-b0d1-a7d12495c89d%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
Adrien Grand

--
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/82cf53b7-6028-42c0-8f68-2ebc430b5cf2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #6