Penalty or boost from a boolean property

Hi,

I'm looking for help :slight_smile: This is maybe trivial but I can't find the good
solution.

I have some documents and those documents have two boolean properties,
basically thumbs up and thumbs down to show that the administrator approve
or not those documents.
I try to boost a document if it is "thumbsup" or demote the document if it
is thumbsdown. It's not a filter, the document could be retrieved, it's
just more or less relevant.

I tried with two should clauses in the global request :

{
"bool" : {
"should" : [
{
"term" : { "champ1" : "valeur1" }
},
{
"term" : { "champ2" : "valeur2" }
},
{
"term" : { "thumbsup" : true }
},
{
"term" : { "thumbsdown" : false}
}
]
}
}

But I get some irrelevant documents because they match the last conditions.
What would be the best method for this use case ?

--
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/ba3964f0-fbc8-4e0c-be3f-c38af8221410%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Function_score is the way to go IMHO.

Best

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 20 juin 2014 à 19:50, hugo lassiege hlassiege@gmail.com a écrit :

Hi,

I'm looking for help :slight_smile: This is maybe trivial but I can't find the good solution.

I have some documents and those documents have two boolean properties, basically thumbs up and thumbs down to show that the administrator approve or not those documents.
I try to boost a document if it is "thumbsup" or demote the document if it is thumbsdown. It's not a filter, the document could be retrieved, it's just more or less relevant.

I tried with two should clauses in the global request :

{
"bool" : {
"should" : [
{
"term" : { "champ1" : "valeur1" }
},
{
"term" : { "champ2" : "valeur2" }
},
{
"term" : { "thumbsup" : true }
},
{
"term" : { "thumbsdown" : false}
}
]
}
}

But I get some irrelevant documents because they match the last conditions.
What would be the best method for this use case ?

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/ba3964f0-fbc8-4e0c-be3f-c38af8221410%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/088863F1-E2EA-45A6-9368-D9AA69E717FE%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

Thanks for your help. It works :slight_smile:

2014-06-20 19:54 GMT+02:00 David Pilato david@pilato.fr:

Function_score is the way to go IMHO.

Best

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 20 juin 2014 à 19:50, hugo lassiege hlassiege@gmail.com a écrit :

Hi,

I'm looking for help :slight_smile: This is maybe trivial but I can't find the good
solution.

I have some documents and those documents have two boolean properties,
basically thumbs up and thumbs down to show that the administrator approve
or not those documents.
I try to boost a document if it is "thumbsup" or demote the document if it
is thumbsdown. It's not a filter, the document could be retrieved, it's
just more or less relevant.

I tried with two should clauses in the global request :

{
"bool" : {
"should" : [
{
"term" : { "champ1" : "valeur1" }
},
{
"term" : { "champ2" : "valeur2" }
},
{
"term" : { "thumbsup" : true }
},
{
"term" : { "thumbsdown" : false}
}
]
}
}

But I get some irrelevant documents because they match the last
conditions.
What would be the best method for this use case ?

--
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/ba3964f0-fbc8-4e0c-be3f-c38af8221410%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/ba3964f0-fbc8-4e0c-be3f-c38af8221410%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/26Y62Eisrm4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/088863F1-E2EA-45A6-9368-D9AA69E717FE%40pilato.fr
https://groups.google.com/d/msgid/elasticsearch/088863F1-E2EA-45A6-9368-D9AA69E717FE%40pilato.fr?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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/CAKXL5Nh7wPrYMpkE7NmopbOULT34w_etBgD076YTUBnpoYxbhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.