# Applying filters to the phrase suggester's scoring

**URL:** https://discuss.elastic.co/t/applying-filters-to-the-phrase-suggesters-scoring/13044
**Category:** Elasticsearch
**Created:** [August 2, 2013, 2:40pm UTC](https://discuss.elastic.co/t/applying-filters-to-the-phrase-suggesters-scoring/13044 "2013-08-02T14:40:00Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)
#### Post date: [August 2, 2013, 2:40pm UTC](https://discuss.elastic.co/t/applying-filters-to-the-phrase-suggesters-scoring/13044/1 "2013-08-02T14:40:00Z")

</div>

Elasticsearch,

Does anyone know of a way to make the scores from the phrase suggester  
respect the filtering in the query? It is pretty lame that I suggest  
phrases that produce no results because they've been filtered out.

Nik

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)
#### Post date: [August 2, 2013, 8:07pm UTC](https://discuss.elastic.co/t/applying-filters-to-the-phrase-suggesters-scoring/13044/2 "2013-08-02T20:07:18Z")

</div>

currently there is no such thing as filtering. Yet we don't really apply  
filters when building these suggestions for the most parts this would be a  
serious performance bottleneck. The best solution is to keep separate  
suggest fields for each different "filter" if this is possible. I don't  
think we can support arbitrary filters the way the suggester works today. I  
might be able to add a feature that runs a certain filter as a post step to  
make sure that we rather return nothing than a suggestion that is not  
returning results. Would that help you?

simon

On Friday, August 2, 2013 4:40:00 PM UTC+2, Nikolas Everett wrote:

> Elasticsearch,
> 
> Does anyone know of a way to make the scores from the phrase suggester  
> respect the filtering in the query? It is pretty lame that I suggest  
> phrases that produce no results because they've been filtered out.
> 
> Nik

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)
#### Post date: [August 5, 2013, 3:44pm UTC](https://discuss.elastic.co/t/applying-filters-to-the-phrase-suggesters-scoring/13044/3 "2013-08-05T15:44:52Z")

</div>

I was planning on partitioning my data for search speed reasons anyway but  
had shied away from it as a premature optimization. That single partition  
would solve 80% of my problems with that lack of a filter. I can certainly  
see why a filter would cause a huge performance hit.

Before I look at a post step filter I'll see what I get out of partitioning  
my documents.

Nik

On Fri, Aug 2, 2013 at 4:07 PM, simonw [simon.willnauer@elasticsearch.com](mailto:simon.willnauer@elasticsearch.com)wrote:

> currently there is no such thing as filtering. Yet we don't really apply  
> filters when building these suggestions for the most parts this would be a  
> serious performance bottleneck. The best solution is to keep separate  
> suggest fields for each different "filter" if this is possible. I don't  
> think we can support arbitrary filters the way the suggester works today. I  
> might be able to add a feature that runs a certain filter as a post step to  
> make sure that we rather return nothing than a suggestion that is not  
> returning results. Would that help you?
> 
> simon
> 
> On Friday, August 2, 2013 4:40:00 PM UTC+2, Nikolas Everett wrote:
> 
> > Elasticsearch,
> > 
> > Does anyone know of a way to make the scores from the phrase suggester  
> > respect the filtering in the query? It is pretty lame that I suggest  
> > phrases that produce no results because they've been filtered out.
> > 
> > Nik
> 
> --  
> 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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 2:22am UTC](https://discuss.elastic.co/t/applying-filters-to-the-phrase-suggesters-scoring/13044/4 "2017-07-06T02:22:51Z")

</div>


