# How to make some docs less relevant on search

**URL:** <https://discuss.elastic.co/t/how-to-make-some-docs-less-relevant-on-search/15625>\
**Category:** Elasticsearch\
**Created:** [February 5, 2014, 6:25pm UTC](https://discuss.elastic.co/t/how-to-make-some-docs-less-relevant-on-search/15625 "2014-02-05T18:25:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tiago\_Rodrigues](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@Tiago\_Rodrigues](https://discuss.elastic.co/u/Tiago_Rodrigues)\
**Post date:** [February 5, 2014, 6:25pm UTC](https://discuss.elastic.co/t/how-to-make-some-docs-less-relevant-on-search/15625/1 "2014-02-05T18:25:28Z")

</div>

Hello all,

I have some docs with field 'title' and 'category'. I need to make a query  
where i need to use 'match\_query' on field 'title' and make all category  
with word "other" appear after all other categorys.  
I can made 2 querys, but I have too much docs, it not will done right.  
I tried use 'bool' with boost and 'Custom Score Query' but i realy don´t  
know if I can use for this purpose.

Anyone know how i can make it?

Thanks for any help and sory for my poor english.

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/50c49da1-8d02-4c7d-9efc-a77a0001dea8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/50c49da1-8d02-4c7d-9efc-a77a0001dea8%40googlegroups.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:** [February 5, 2014, 6:29pm UTC](https://discuss.elastic.co/t/how-to-make-some-docs-less-relevant-on-search/15625/2 "2014-02-05T18:29:40Z")

</div>

You could use use a function score query with a clause with a filter. That  
filter could select things in the other field and multiply their score by  
.01 or something. That'd mostly do what you want, I think.

Nik

On Wed, Feb 5, 2014 at 1:25 PM, Tiago Rodrigues [tiago\_tk21@hotmail.com](mailto:tiago_tk21@hotmail.com)wrote:

> Hello all,
> 
> I have some docs with field 'title' and 'category'. I need to make a query  
> where i need to use 'match\_query' on field 'title' and make all category  
> with word "other" appear after all other categorys.  
> I can made 2 querys, but I have too much docs, it not will done right.  
> I tried use 'bool' with boost and 'Custom Score Query' but i realy don´t  
> know if I can use for this purpose.
> 
> Anyone know how i can make it?
> 
> Thanks for any help and sory for my poor english.
> 
> --  
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/50c49da1-8d02-4c7d-9efc-a77a0001dea8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/50c49da1-8d02-4c7d-9efc-a77a0001dea8%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0LxfpffcsEZyo3nbu0jeG42%2B2hGLCtBJn8TYue9R-cNA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0LxfpffcsEZyo3nbu0jeG42%2B2hGLCtBJn8TYue9R-cNA%40mail.gmail.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:** [February 5, 2014, 6:32pm UTC](https://discuss.elastic.co/t/how-to-make-some-docs-less-relevant-on-search/15625/3 "2014-02-05T18:32:33Z")

</div>

You could also try a boosting query where the negative clause is a filtered  
query matching the other field, I believe.

Nik

On Wed, Feb 5, 2014 at 1:29 PM, Nikolas Everett [nik9000@gmail.com](mailto:nik9000@gmail.com) wrote:

> You could use use a function score query with a clause with a filter.  
> That filter could select things in the other field and multiply their score  
> by .01 or something. That'd mostly do what you want, I think.
> 
> Nik
> 
> On Wed, Feb 5, 2014 at 1:25 PM, Tiago Rodrigues [tiago\_tk21@hotmail.com](mailto:tiago_tk21@hotmail.com)wrote:
> 
> > Hello all,
> > 
> > I have some docs with field 'title' and 'category'. I need to make a  
> > query where i need to use 'match\_query' on field 'title' and make all  
> > category with word "other" appear after all other categorys.  
> > I can made 2 querys, but I have too much docs, it not will done right.  
> > I tried use 'bool' with boost and 'Custom Score Query' but i realy don´t  
> > know if I can use for this purpose.
> > 
> > Anyone know how i can make it?
> > 
> > Thanks for any help and sory for my poor english.
> > 
> > --  
> > 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).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/50c49da1-8d02-4c7d-9efc-a77a0001dea8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/50c49da1-8d02-4c7d-9efc-a77a0001dea8%40googlegroups.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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAPmjWd3y%3DEOCBkPFLoZQ5AEzz6\_Y%3Do%2BG3\_v6owV7fMS7rx3MeA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd3y%3DEOCBkPFLoZQ5AEzz6_Y%3Do%2BG3_v6owV7fMS7rx3MeA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Tiago\_Rodrigues](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@Tiago\_Rodrigues](https://discuss.elastic.co/u/Tiago_Rodrigues)\
**Post date:** [February 5, 2014, 6:44pm UTC](https://discuss.elastic.co/t/how-to-make-some-docs-less-relevant-on-search/15625/4 "2014-02-05T18:44:59Z")

</div>

Thanks, but, when I use the functions score, he returns only the docs who  
have 'other' in category field.

I realy don´t understand the function\_score.

You could use use a function score query with a clause with a filter. That

> filter could select things in the other field and multiply their score by  
> .01 or something. That'd mostly do what you want, I think.
> 
> 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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/2def5e7b-7a8c-4d53-a58a-c60d106f8e3e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2def5e7b-7a8c-4d53-a58a-c60d106f8e3e%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Tiago\_Rodrigues](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@Tiago\_Rodrigues](https://discuss.elastic.co/u/Tiago_Rodrigues)\
**Post date:** [February 5, 2014, 6:50pm UTC](https://discuss.elastic.co/t/how-to-make-some-docs-less-relevant-on-search/15625/5 "2014-02-05T18:50:04Z")

</div>

Oh, I trying it now, and appear to be ok.

I will return if some think not whas right.

Em quarta-feira, 5 de fevereiro de 2014 16h32min33s UTC-2, Nikolas Everett  
escreveu:

> You could also try a boosting query where the negative clause is a  
> filtered query matching the other field, I believe.
> 
> 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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/2dc6b218-3f74-4a20-b25b-9654c79ee3fc%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2dc6b218-3f74-4a20-b25b-9654c79ee3fc%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Tiago\_Rodrigues](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@Tiago\_Rodrigues](https://discuss.elastic.co/u/Tiago_Rodrigues)\
**Post date:** [February 5, 2014, 7:44pm UTC](https://discuss.elastic.co/t/how-to-make-some-docs-less-relevant-on-search/15625/6 "2014-02-05T19:44:56Z")

</div>

Thanks Nikolas !

boosting query solves my problem.

Em quarta-feira, 5 de fevereiro de 2014 16h32min33s UTC-2, Nikolas Everett  
escreveu:

> You could also try a boosting query where the negative clause is a  
> filtered query matching the other field, I believe.
> 
> 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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d3b1ee83-3d11-4ea7-83e2-d96eb3d91a98%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d3b1ee83-3d11-4ea7-83e2-d96eb3d91a98%40googlegroups.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, 1:52am UTC](https://discuss.elastic.co/t/how-to-make-some-docs-less-relevant-on-search/15625/7 "2017-07-06T01:52:18Z")

</div>


