Specifying filters in the suggest query

Hi all - I see that _suggest API has been introduced recently although it
is still in experiment phase. I am wondering if there is a way to specify
filter in the suggest API. This is to ensure that the suggestions are
confined based on the specified filter.
I tried putting a top level filter (basically like below) but that just
filtered my query result and didn't apply for suggestions.

Any thoughts on how I can add a filter to the suggest request?

{
"query": {
"query_string": {
"query": "........",
"default_operator": "and"
}
},
"filter": {
"term": {
"...........": "..........."
}
},
"explain": true,
"suggest": {
"myTermSuggestionBuilder": {
"text": "...............",
"term": {
"field": "................",
"size": 5,
"suggest_mode": "always",
"min_word_len": 3
}
},
"myPhraseSuggestionBuilder": {
"text": "...........",
"phrase": {
"field": "..................",
"size": 5,
"max_errors": 0.5,
"gram_size": 3,
"direct_generator": [
{
"field": "...................",
"suggest_mode": "always",
"min_word_len": 3
}
]
}
}
}
}

Amit

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

the short answer is "no" - there is no way to apply filters. I don't think
we are able to add those without killing performance.

simon

On Thursday, August 15, 2013 10:26:54 PM UTC+2, amit.soni wrote:

Hi all - I see that _suggest API has been introduced recently although it
is still in experiment phase. I am wondering if there is a way to specify
filter in the suggest API. This is to ensure that the suggestions are
confined based on the specified filter.
I tried putting a top level filter (basically like below) but that just
filtered my query result and didn't apply for suggestions.

Any thoughts on how I can add a filter to the suggest request?

{
"query": {
"query_string": {
"query": "........",
"default_operator": "and"
}
},
"filter": {
"term": {
"...........": "..........."
}
},
"explain": true,
"suggest": {
"myTermSuggestionBuilder": {
"text": "...............",
"term": {
"field": "................",
"size": 5,
"suggest_mode": "always",
"min_word_len": 3
}
},
"myPhraseSuggestionBuilder": {
"text": "...........",
"phrase": {
"field": "..................",
"size": 5,
"max_errors": 0.5,
"gram_size": 3,
"direct_generator": [
{
"field": "...................",
"suggest_mode": "always",
"min_word_len": 3
}
]
}
}
}
}

Amit

--
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 for the quick reply Simon. In our use case, we try to main logical
partitions of data (say we index user account information and hence we want
to offer suggestions only relevant to user data).

Do you have recommendation on how to proceed?

-Amit.

On Thu, Aug 15, 2013 at 1:47 PM, simonw
simon.willnauer@elasticsearch.comwrote:

the short answer is "no" - there is no way to apply filters. I don't think
we are able to add those without killing performance.

simon

On Thursday, August 15, 2013 10:26:54 PM UTC+2, amit.soni wrote:

Hi all - I see that _suggest API has been introduced recently although it
is still in experiment phase. I am wondering if there is a way to specify
filter in the suggest API. This is to ensure that the suggestions are
confined based on the specified filter.
I tried putting a top level filter (basically like below) but that just
filtered my query result and didn't apply for suggestions.

Any thoughts on how I can add a filter to the suggest request?

{
"query": {
"query_string": {
"query": "........",
"default_operator": "and"
}
},
"filter": {
"term": {
"...........": "..........."
}
},
"explain": true,
"suggest": {
"myTermSuggestionBuilder": {
"text": "...............",
"term": {
"field": "................",
"size": 5,
"suggest_mode": "always",
"min_word_len": 3
}
},
"myPhraseSuggestionBuilder": {
"text": "...........",
"phrase": {
"field": "..................",
"size": 5,
"max_errors": 0.5,
"gram_size": 3,
"direct_generator": [
{
"field": "...................",
"suggest_mode": "always",
"min_word_len": 3
}
]
}
}
}
}

Amit

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