Filter only if there are matches against a field

Hi all,
What I'm trying to do is a search that will narrow down results to specific
locations. If a user types "iphones in London" I would like to show results
in London and exclude everything else.
If the search is "red iphone" then the filter should not be applied.

I know I can use different boosts but I need to use a different ordering by
time. So results that are recent and not in the location are bumped up to
the top.

Is there anyway to do this in a query or do I need to do it in code / query?

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 are not looking at Boosts, you want to use geo-filter and
location-aware query parsing

On Wed, Jul 10, 2013 at 3:27 PM, Andrea Salvadore <
andrea.salvadore@gmail.com> wrote:

Hi all,
What I'm trying to do is a search that will narrow down results to
specific locations. If a user types "iphones in London" I would like to
show results in London and exclude everything else.
If the search is "red iphone" then the filter should not be applied.

I know I can use different boosts but I need to use a different ordering
by time. So results that are recent and not in the location are bumped up
to the top.

Is there anyway to do this in a query or do I need to do it in code /
query?

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.

Hi Itamar, thanks for your comment.
The location is an example as I need to do the same thing for other fields,
like categories..

A user could type "Hamlet in Books" I would like to filter out anything
that is not a book..

On Wednesday, 10 July 2013 14:53:19 UTC+1, Itamar Syn-Hershko wrote:

You are not looking at Boosts, you want to use geo-filter and
location-aware query parsing
Elasticsearch Platform — Find real-time answers at scale | Elastic

On Wed, Jul 10, 2013 at 3:27 PM, Andrea Salvadore <andrea.s...@gmail.com<javascript:>

wrote:

Hi all,
What I'm trying to do is a search that will narrow down results to
specific locations. If a user types "iphones in London" I would like to
show results in London and exclude everything else.
If the search is "red iphone" then the filter should not be applied.

I know I can use different boosts but I need to use a different ordering
by time. So results that are recent and not in the location are bumped up
to the top.

Is there anyway to do this in a query or do I need to do it in code /
query?

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.

And then you'll use a Term filter or similar. In other words, you need to
work out a way to parse your app's query language to ES's query DSL which
includes filters. A good way to do that is use visual facets instead of
free-text queries.

On Wed, Jul 10, 2013 at 6:28 PM, Andrea Salvadore <
andrea.salvadore@gmail.com> wrote:

Hi Itamar, thanks for your comment.
The location is an example as I need to do the same thing for other
fields, like categories..

A user could type "Hamlet in Books" I would like to filter out anything
that is not a book..

On Wednesday, 10 July 2013 14:53:19 UTC+1, Itamar Syn-Hershko wrote:

You are not looking at Boosts, you want to use geo-filter and
location-aware query parsing http://www.Elasticsearch Platform — Find real-time answers at scale | Elastic
reference/query-dsl/geo-**distance-filter/http://www.elasticsearch.org/guide/reference/query-dsl/geo-distance-filter/

On Wed, Jul 10, 2013 at 3:27 PM, Andrea Salvadore andrea.s...@gmail.comwrote:

Hi all,
What I'm trying to do is a search that will narrow down results to
specific locations. If a user types "iphones in London" I would like to
show results in London and exclude everything else.
If the search is "red iphone" then the filter should not be applied.

I know I can use different boosts but I need to use a different ordering
by time. So results that are recent and not in the location are bumped up
to the top.

Is there anyway to do this in a query or do I need to do it in code /
query?

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.

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

--
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 Itamar,
could you go a bit into more details about using facets for this?
I would still have to run 2 separate queries, is that correct?

On Wednesday, 10 July 2013 16:36:25 UTC+1, Itamar Syn-Hershko wrote:

And then you'll use a Term filter or similar. In other words, you need to
work out a way to parse your app's query language to ES's query DSL which
includes filters. A good way to do that is use visual facets instead of
free-text queries.

On Wed, Jul 10, 2013 at 6:28 PM, Andrea Salvadore <andrea.s...@gmail.com<javascript:>

wrote:

Hi Itamar, thanks for your comment.
The location is an example as I need to do the same thing for other
fields, like categories..

A user could type "Hamlet in Books" I would like to filter out anything
that is not a book..

On Wednesday, 10 July 2013 14:53:19 UTC+1, Itamar Syn-Hershko wrote:

You are not looking at Boosts, you want to use geo-filter and
location-aware query parsing http://www.Elasticsearch Platform — Find real-time answers at scale | Elastic
reference/query-dsl/geo-**distance-filter/http://www.elasticsearch.org/guide/reference/query-dsl/geo-distance-filter/

On Wed, Jul 10, 2013 at 3:27 PM, Andrea Salvadore <andrea.s...@gmail.com

wrote:

Hi all,
What I'm trying to do is a search that will narrow down results to
specific locations. If a user types "iphones in London" I would like to
show results in London and exclude everything else.
If the search is "red iphone" then the filter should not be applied.

I know I can use different boosts but I need to use a different
ordering by time. So results that are recent and not in the location are
bumped up to the top.

Is there anyway to do this in a query or do I need to do it in code /
query?

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.

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