Filtered autocomplete (suggester)

Hi,
I am trying to combine it with the query or a filter with suggester, so
that suggestions are returned only for the hits. Is it possible to
constraint autcomplete (or any suggester for that matter) to work on a
subset of data. E.g. I've got some users with associated documents and I
want to serve them document title suggestions but only for the documents
they can access. I've tried:

{
"filter" : {
"term" : {
"user_id" : "test"
}
},
"suggest" : {
"title_suggester" : {
"text" : "r",
"completion" : {
"field" : "title_suggest"
}
}
}
}

and it returns all documents for user "test, and all suggestions for all
users. I was able to hack around it by introducing an extra user_id as a
prefix for every suggestions, but looking for a more principled way.
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/6589e91d-fcd4-49db-b8c7-317ee800a498%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hey,

the completion suggester does not execute a real search query as it uses
different data structures. This also means, that it does not support
filters. There are plans to support something like a context in order to
have a lightweight filter, see

This will allow you suggest only for products in a certain category or for
restaurants around you (as it also has geo support).

--Alex

On Wed, Jan 29, 2014 at 1:18 PM, Ilija Subasic subasic.ilija@gmail.comwrote:

Hi,
I am trying to combine it with the query or a filter with suggester, so
that suggestions are returned only for the hits. Is it possible to
constraint autcomplete (or any suggester for that matter) to work on a
subset of data. E.g. I've got some users with associated documents and I
want to serve them document title suggestions but only for the documents
they can access. I've tried:

{
"filter" : {
"term" : {
"user_id" : "test"
}
},
"suggest" : {
"title_suggester" : {
"text" : "r",
"completion" : {
"field" : "title_suggest"
}
}
}
}

and it returns all documents for user "test, and all suggestions for all
users. I was able to hack around it by introducing an extra user_id as a
prefix for every suggestions, but looking for a more principled way.
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/6589e91d-fcd4-49db-b8c7-317ee800a498%40googlegroups.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGCwEM_QnXhauX2MNDX%2BWtqhmBoEypY50om%2BpqrJVi3-QNPJBA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.