# Only count matches once

**URL:** <https://discuss.elastic.co/t/only-count-matches-once/13935>\
**Category:** Elasticsearch\
**Created:** [October 14, 2013, 12:16am UTC](https://discuss.elastic.co/t/only-count-matches-once/13935 "2013-10-14T00:16:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Squires](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_squires/32/2046_2.png) [@David\_Squires](https://discuss.elastic.co/u/David_Squires)\
**Post date:** [October 14, 2013, 12:16am UTC](https://discuss.elastic.co/t/only-count-matches-once/13935/1 "2013-10-14T00:16:49Z")

</div>

Hello,

I've tried a few different analyzers thinking that the stop words were  
causing the results to be poor, but now it seems that it's a result of the  
same token being matched multiple times, being given more weight.

For example a search for "this is the end", returns the following results:

1. TutsPlus - End To End Analytics
2. This Is The End (2013) Movie HD

As you can see, TutsPlus is pretty unrelated to what a user would be  
searching for. I guess it's just because 'End' is found twice.

Is there anyway to only give weight to a single instance of a term or could  
you recommend what I should look at to provide a more relevant result?  
Really, the TutsPlus should not even be returned, or maybe way down the  
line.

Thank you!

--  
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:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [October 14, 2013, 12:22am UTC](https://discuss.elastic.co/t/only-count-matches-once/13935/2 "2013-10-14T00:22:45Z")

</div>

Can you give the query you used?

Jörg

--  
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:** [October 14, 2013, 12:26am UTC](https://discuss.elastic.co/t/only-count-matches-once/13935/3 "2013-10-14T00:26:51Z")

</div>

You could use a boost query or a rescore to match the phrase the user searched.

Sent from my iPhone

> On Oct 13, 2013, at 8:16 PM, David Squires [dave@bluetopmedia.com](mailto:dave@bluetopmedia.com) wrote:
> 
> Hello,
> 
> I've tried a few different analyzers thinking that the stop words were causing the results to be poor, but now it seems that it's a result of the same token being matched multiple times, being given more weight.
> 
> For example a search for "this is the end", returns the following results:
> 
> 1. TutsPlus - End To End Analytics
> 2. This Is The End (2013) Movie HD
> 
> As you can see, TutsPlus is pretty unrelated to what a user would be searching for. I guess it's just because 'End' is found twice.
> 
> Is there anyway to only give weight to a single instance of a term or could you recommend what I should look at to provide a more relevant result? Really, the TutsPlus should not even be returned, or maybe way down the line.
> 
> ## Thank you!
> 
> 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:** ![David\_Squires](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_squires/32/2046_2.png) [@David\_Squires](https://discuss.elastic.co/u/David_Squires)\
**Post date:** [October 14, 2013, 1:46am UTC](https://discuss.elastic.co/t/only-count-matches-once/13935/4 "2013-10-14T01:46:40Z")

</div>

I'm just using a standard query, I've tried messing filters and match, but  
nothing that I played with seemed to get it...

{  
"query": {  
"name" : "this is the end"  
}  
}

On Sunday, October 13, 2013 8:26:51 PM UTC-4, Nikolas Everett wrote:

> You could use a boost query or a rescore to match the phrase the user  
> searched.
> 
> Sent from my iPhone
> 
> On Oct 13, 2013, at 8:16 PM, David Squires \<[da...@bluetopmedia.com](mailto:da...@bluetopmedia.com)\<javascript:\>\>  
> wrote:
> 
> Hello,
> 
> I've tried a few different analyzers thinking that the stop words were  
> causing the results to be poor, but now it seems that it's a result of the  
> same token being matched multiple times, being given more weight.
> 
> For example a search for "this is the end", returns the following results:
> 
> 1. TutsPlus - End To End Analytics
> 2. This Is The End (2013) Movie HD
> 
> As you can see, TutsPlus is pretty unrelated to what a user would be  
> searching for. I guess it's just because 'End' is found twice.
> 
> Is there anyway to only give weight to a single instance of a term or  
> could you recommend what I should look at to provide a more relevant  
> result? Really, the TutsPlus should not even be returned, or maybe way down  
> the line.
> 
> Thank you!
> 
> --  
> 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](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> 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:12am UTC](https://discuss.elastic.co/t/only-count-matches-once/13935/5 "2017-07-06T02:12:42Z")

</div>


