GeoLocated search and facet scoping

So we've been working with ElasticSearch and Geo Locations in Rails using
Tire, and have run into an issue.

We have locations, those locations have several attributes that can be
searched on including tags. Tags are also facets. Currently all the search
attributes except location are included in the Tire search using a "must"
query. The location part of the search is done via a filter. Right now the
search results return an attribute, current_tags, for the list of facets
scoped by the current "must" query.

The problem is that current_tags is not scoped by the location because it's
a filter.

I can see two possible solutions. 1. move the location filter into the
"must" query. 2. scope the current_tags by the filter. Either of these
would work if either of these were supported. Unfortunately I can't find
anything on Elastic for how to support either of these options.

So if anyone knows how to get a list of facets out of ElasticSearch that
have been scoped by a geo-aware search, I'd really appreciate a quick
explanation on how to do it.

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

If I understand your problem correctly (I might be wrong), it seems like
you are using a query with a top-level filter. Can you provide an example
query? If so, the easiest solution would be to change your query/filter
into a filtered query. The documents faceted on will be only be those that
pass the filtered query. In the case of a top-level filter, the documents
faceted on will not be affected by the filter. In this case, you can also
use the same top-level filter as as facet_filter.

Cheers,

Ivan

On Mon, Sep 9, 2013 at 6:10 AM, Billy Catherall bcatherall@gmail.comwrote:

So we've been working with Elasticsearch and Geo Locations in Rails using
Tire, and have run into an issue.

We have locations, those locations have several attributes that can be
searched on including tags. Tags are also facets. Currently all the search
attributes except location are included in the Tire search using a "must"
query. The location part of the search is done via a filter. Right now the
search results return an attribute, current_tags, for the list of facets
scoped by the current "must" query.

The problem is that current_tags is not scoped by the location because
it's a filter.

I can see two possible solutions. 1. move the location filter into the
"must" query. 2. scope the current_tags by the filter. Either of these
would work if either of these were supported. Unfortunately I can't find
anything on Elastic for how to support either of these options.

So if anyone knows how to get a list of facets out of Elasticsearch that
have been scoped by a geo-aware search, I'd really appreciate a quick
explanation on how to do it.

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

Thanks Ivan. That was exactly what I needed to fix it. Just wrapping both
the query and the filter correctly (as in the link) did the trick.

On Tuesday, September 10, 2013 11:22:50 AM UTC-4, Ivan Brusic wrote:

If I understand your problem correctly (I might be wrong), it seems like
you are using a query with a top-level filter. Can you provide an example
query? If so, the easiest solution would be to change your query/filter
into a filtered query. The documents faceted on will be only be those that
pass the filtered query. In the case of a top-level filter, the documents
faceted on will not be affected by the filter. In this case, you can also
use the same top-level filter as as facet_filter.

Elasticsearch Platform — Find real-time answers at scale | Elastic

Cheers,

Ivan

On Mon, Sep 9, 2013 at 6:10 AM, Billy Catherall <bcath...@gmail.com<javascript:>

wrote:

So we've been working with Elasticsearch and Geo Locations in Rails using
Tire, and have run into an issue.

We have locations, those locations have several attributes that can be
searched on including tags. Tags are also facets. Currently all the search
attributes except location are included in the Tire search using a "must"
query. The location part of the search is done via a filter. Right now the
search results return an attribute, current_tags, for the list of facets
scoped by the current "must" query.

The problem is that current_tags is not scoped by the location because
it's a filter.

I can see two possible solutions. 1. move the location filter into the
"must" query. 2. scope the current_tags by the filter. Either of these
would work if either of these were supported. Unfortunately I can't find
anything on Elastic for how to support either of these options.

So if anyone knows how to get a list of facets out of Elasticsearch that
have been scoped by a geo-aware search, I'd really appreciate a quick
explanation on how to do it.

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 elasticsearc...@googlegroups.com <javascript:>.
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.