Scoring when query match a single field

Hi !

I am currently indexing documents that represent a category page.
This documents have different fields like "category" and "brand".

Let's imagine a document A having category "Fashion" and no brand defined,
and a document B having category "Fashion" and brand "Adidas".
When I am querying for "Fashion" in the fields category and brand, I would
like the document A having a higher score then the document B.

Currently, the reverse is happening. How could I avoid it ?

When a document has only one field which is matching, I would like its
score beeing higher then an other document having the same field matching +
other fields defined.

I am not sure that my question is very clear so I have added some
information about my mapping, the query I am doing and the results I
am currently getting here :

Thank you in advance !

Sebastian

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

What happens if you set boost to 0.5 for brand field?

Just a side note: you can set boosting at query time instead of index time.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 14 mai 2013 à 11:37, Sebastianpx sebastian.piedoux@gmail.com a écrit :

Hi !

I am currently indexing documents that represent a category page.
This documents have different fields like "category" and "brand".

Let's imagine a document A having category "Fashion" and no brand defined, and a document B having category "Fashion" and brand "Adidas".
When I am querying for "Fashion" in the fields category and brand, I would like the document A having a higher score then the document B.

Currently, the reverse is happening. How could I avoid it ?

When a document has only one field which is matching, I would like its score beeing higher then an other document having the same field matching + other fields defined.

I am not sure that my question is very clear so I have added some information about my mapping, the query I am doing and the results I am currently getting here :
gist:5574793 · GitHub

Thank you in advance !

Sebastian

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

Thank you for your help David.

I just tried it out but actually it is even worst. In the example I posted
on gist, my document having only "category":"Moda" without any other fields
is now in position 4.

On Tuesday, 14 May 2013 11:45:17 UTC+2, David Pilato wrote:

What happens if you set boost to 0.5 for brand field?

Just a side note: you can set boosting at query time instead of index time.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 14 mai 2013 à 11:37, Sebastianpx <sebastia...@gmail.com <javascript:>>
a écrit :

Hi !

I am currently indexing documents that represent a category page.
This documents have different fields like "category" and "brand".

Let's imagine a document A having category "Fashion" and no brand defined,
and a document B having category "Fashion" and brand "Adidas".
When I am querying for "Fashion" in the fields category and brand, I would
like the document A having a higher score then the document B.

Currently, the reverse is happening. How could I avoid it ?

When a document has only one field which is matching, I would like its
score beeing higher then an other document having the same field matching +
other fields defined.

I am not sure that my question is very clear so I have added some
information about my mapping, the query I am doing and the results I
am currently getting here :
gist:5574793 · GitHub

Thank you in advance !

Sebastian

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

can you maybe use a

with a

and give docs a boost that don't have a value in a certain field?

simon

On Tuesday, May 14, 2013 11:37:51 AM UTC+2, Sebastianpx wrote:

Hi !

I am currently indexing documents that represent a category page.
This documents have different fields like "category" and "brand".

Let's imagine a document A having category "Fashion" and no brand defined,
and a document B having category "Fashion" and brand "Adidas".
When I am querying for "Fashion" in the fields category and brand, I would
like the document A having a higher score then the document B.

Currently, the reverse is happening. How could I avoid it ?

When a document has only one field which is matching, I would like its
score beeing higher then an other document having the same field matching +
other fields defined.

I am not sure that my question is very clear so I have added some
information about my mapping, the query I am doing and the results I
am currently getting here :
gist:5574793 · GitHub

Thank you in advance !

Sebastian

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

Hi Simon !

Thanks for you answer. I gave it a try with boosting missing fields but
still I am not notally satisfied with the result.
If I have one document with category "Moda" and an other document with
category "Moda" and brand "Vera Moda", the score of the second document is
still higher then the first one.
My query looks like that:

{
"query": {
"custom_filters_score": {
"query": {
"multi_match": {
"query": "Moda",
"fields": [
"category",
"brand"
]
}
},
"filters": [
{
"filter": {
"missing": {
"field": "brand"
}
},
"boost": "10"
},
{
"filter": {
"missing": {
"field": "category"
}
},
"boost": "10"
}
],
"score_mode": "first"
}
}
}

Did I do something wrong ?

Sebastian

On Wednesday, 15 May 2013 06:23:50 UTC+2, simonw wrote:

can you maybe use a

Elasticsearch Platform — Find real-time answers at scale | Elastic

with a

Elasticsearch Platform — Find real-time answers at scale | Elastic

and give docs a boost that don't have a value in a certain field?

simon

On Tuesday, May 14, 2013 11:37:51 AM UTC+2, Sebastianpx wrote:

Hi !

I am currently indexing documents that represent a category page.
This documents have different fields like "category" and "brand".

Let's imagine a document A having category "Fashion" and no brand
defined, and a document B having category "Fashion" and brand "Adidas".
When I am querying for "Fashion" in the fields category and brand, I
would like the document A having a higher score then the document B.

Currently, the reverse is happening. How could I avoid it ?

When a document has only one field which is matching, I would like its
score beeing higher then an other document having the same field matching +
other fields defined.

I am not sure that my question is very clear so I have added some
information about my mapping, the query I am doing and the results I
am currently getting here :
gist:5574793 · GitHub

Thank you in advance !

Sebastian

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