Limit Completion Suggestion Results Based on other fields


(Johny Lam) #1

Is it possible to restrict the results returned by the completion suggester
to only the documents where a certain field matches something?

For example, with the hotel index on
http://www.elasticsearch.org/blog/you-complete-me/, is it possible to only
get suggestions for hotels where the city is a specific city?

Thanks,
Johny Lam

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


(Luca Cavanna) #2

Hi,
since the completion suggester is based on an FST that is loaded into
memory and kept up-to-date at index time, it is not possible to filter
suggestions.
What you would need to do in your case is to build a different FST per
city, but whether that's doable or not depends on how many city you have in
your system. What I'm saying is that you pretty much need to know in
advance the possible filters that might be applied and build a proper data
structure at index time.

One other thing that you might want to consider is adding a prefix that
contains the name of the city to your suggestions (input).

Hope this helps
Luca

On Thursday, October 17, 2013 1:57:29 AM UTC+2, Johny Lam wrote:

Is it possible to restrict the results returned by the completion
suggester to only the documents where a certain field matches something?

For example, with the hotel index on
http://www.elasticsearch.org/blog/you-complete-me/, is it possible to
only get suggestions for hotels where the city is a specific city?

Thanks,
Johny Lam

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


(simonw-2) #3

FYI we are working on geo support for the suggester where you can
pre-filter based on geo location, would this help your usecase?

simon

On Thursday, October 17, 2013 1:57:29 AM UTC+2, Johny Lam wrote:

Is it possible to restrict the results returned by the completion
suggester to only the documents where a certain field matches something?

For example, with the hotel index on
http://www.elasticsearch.org/blog/you-complete-me/, is it possible to
only get suggestions for hotels where the city is a specific city?

Thanks,
Johny Lam

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


(Johny Lam) #4

No, my use case doesn't involve geo location. Although now that you bring
it up, what makes it possible to filter by geo location but not by some
other field?

On Friday, October 18, 2013 12:15:07 PM UTC-7, simonw wrote:

FYI we are working on geo support for the suggester where you can
pre-filter based on geo location, would this help your usecase?

simon

On Thursday, October 17, 2013 1:57:29 AM UTC+2, Johny Lam wrote:

Is it possible to restrict the results returned by the completion
suggester to only the documents where a certain field matches something?

For example, with the hotel index on
http://www.elasticsearch.org/blog/you-complete-me/, is it possible to
only get suggestions for hotels where the city is a specific city?

Thanks,
Johny Lam

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


(Amit Soni) #5

hi Luca/Simon - I posted a similar question on this forum earlier. Just
curious to know your recommendation on how we can filter the suggestions
based on the criteria specified in the query filter?

-Amit.

On Mon, Oct 21, 2013 at 4:11 PM, Johny Lam johny.lam@gmail.com wrote:

No, my use case doesn't involve geo location. Although now that you bring
it up, what makes it possible to filter by geo location but not by some
other field?

On Friday, October 18, 2013 12:15:07 PM UTC-7, simonw wrote:

FYI we are working on geo support for the suggester where you can
pre-filter based on geo location, would this help your usecase?

simon

On Thursday, October 17, 2013 1:57:29 AM UTC+2, Johny Lam wrote:

Is it possible to restrict the results returned by the completion
suggester to only the documents where a certain field matches something?

For example, with the hotel index on http://www.elasticsearch.org/
blog/you-complete-me/, is it possible to only get suggestions for
hotels where the city is a specific city?

Thanks,
Johny Lam

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


(Sang Dang) #6

I think you would use edgeNgram and using phrase prefix search to implement
your completion with filter.
As my understand, current version is not support you to do it.

On Wednesday, November 20, 2013 5:19:51 PM UTC-8, amit.soni wrote:

hi Luca/Simon - I posted a similar question on this forum earlier. Just
curious to know your recommendation on how we can filter the suggestions
based on the criteria specified in the query filter?

-Amit.

On Mon, Oct 21, 2013 at 4:11 PM, Johny Lam <john...@gmail.com<javascript:>

wrote:

No, my use case doesn't involve geo location. Although now that you bring
it up, what makes it possible to filter by geo location but not by some
other field?

On Friday, October 18, 2013 12:15:07 PM UTC-7, simonw wrote:

FYI we are working on geo support for the suggester where you can
pre-filter based on geo location, would this help your usecase?

simon

On Thursday, October 17, 2013 1:57:29 AM UTC+2, Johny Lam wrote:

Is it possible to restrict the results returned by the completion
suggester to only the documents where a certain field matches something?

For example, with the hotel index on http://www.elasticsearch.org/
blog/you-complete-me/, is it possible to only get suggestions for
hotels where the city is a specific city?

Thanks,
Johny Lam

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


(system) #7