Facets like Booking.com

Hi,
I am looking for faceting like booking.com.

My use case is as below:

  1. We have 3 categories like (1) Gender , (2) Month , (3) Country
  2. On Selection of Any category it should do AND operation for other
    selected categories options BUT for the one that is selected it should
    fetch all the facets because we want users to select options in the same
    category.

In below example, you can see:

1st image is when page is loaded.
2nd image is when user selects July 2013 month at this time it works fine.
And it filters the Gender properly Female (383) And Male (37)
BUT
3rd image as soon as user selects Female it resets the count to the
original one. It MUST NOT do that. It should be 383 on selection of Female.
No idea what is going wrong.

https://lh4.googleusercontent.com/-HuQdA48JfqA/UdfdCvN6VsI/AAAAAAAAPrM/1uP0ZvdRBXY/s1600/Facets.png

--
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.

It depends on the way you write your query.
I assume you did a FilteredQuery, right?

You can use a Top Level filter instead of change the facet scope.

If it does not make sense, please provide your query (full curl recreation).

HTH

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

Le 6 juil. 2013 à 11:05, Ankur Gandhi ga.gandhi@gmail.com a écrit :

Hi,
I am looking for faceting like booking.com.

My use case is as below:

  1. We have 3 categories like (1) Gender , (2) Month , (3) Country
  2. On Selection of Any category it should do AND operation for other selected categories options BUT for the one that is selected it should fetch all the facets because we want users to select options in the same category.

In below example, you can see:

1st image is when page is loaded.
2nd image is when user selects July 2013 month at this time it works fine. And it filters the Gender properly Female (383) And Male (37)
BUT
3rd image as soon as user selects Female it resets the count to the original one. It MUST NOT do that. It should be 383 on selection of Female. No idea what is going wrong.

--
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.

--
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.

If i understood the problem correctly,
you can filter each facet separately. A JSON-part for the gender facet
could look like the following:

"facets": {
"gender": {
"terms": {
"field": "gender",
"size": 10,
"order": "term"
},
"facet_filter": {
"and": {
"filters": [
{
"or": {
"filters": [
{
"term": {
"arrival_month": "July 2342"
}
}
]
}
}
]
}
}
}

Each facet can be filtered by a combination of AND-and/or single/multiple
ORFilter.

--
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 David,
Thanks for your reply.

Actually I did as mentioned below:

  1. I wrote a query with top level filter.
  2. I applied Filter at Facet level.

Actually issue was applying previous filters to currently selected filters.
Basically for facet calculation, for current selected category, we DID NOT
have to apply the filter and for other facets calculations we had to apply.
And that's where it was failing. I was not finding proper way to do it.

Now it is working fine.

The solution is as mentioned below:

  1. When current category is selected, at that time I am not applying the
    filter to currently selected category facet.
  2. And applying the filters to other facet categories.

That means previously applied filters will be applied to other categories
and not to currently selected category.

If any one wants the query, let me know I will put it with proper example.

Christian and David thanks for your help.

Thanks
Ankur

On Sat, Jul 6, 2013 at 3:00 PM, David Pilato david@pilato.fr wrote:

It depends on the way you write your query.
I assume you did a FilteredQuery, right?

You can use a Top Level filter instead of change the facet scope.

If it does not make sense, please provide your query (full curl
recreation).

HTH

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

Le 6 juil. 2013 à 11:05, Ankur Gandhi ga.gandhi@gmail.com a écrit :

Hi,
I am looking for faceting like booking.com.

My use case is as below:

  1. We have 3 categories like (1) Gender , (2) Month , (3) Country
  2. On Selection of Any category it should do AND operation for other
    selected categories options BUT for the one that is selected it should
    fetch all the facets because we want users to select options in the same
    category.

In below example, you can see:

1st image is when page is loaded.
2nd image is when user selects July 2013 month at this time it works fine.
And it filters the Gender properly Female (383) And Male (37)
BUT
3rd image as soon as user selects Female it resets the count to the
original one. It MUST NOT do that. It should be 383 on selection of Female.
No idea what is going wrong.

https://lh4.googleusercontent.com/-HuQdA48JfqA/UdfdCvN6VsI/AAAAAAAAPrM/1uP0ZvdRBXY/s1600/Facets.png

--
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.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/vxNTHGLYcmg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
Ankur G Gandhi
contact-no: +41 0779186008
E-mail id: ga.gandhi@gmail.com

--
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.