Scoring on a multi_field


(Alan Jurgensen) #1

I have a multi_field where I stash the name several ways: asis, standard,
phonetic, nicknames

am trying to use multi-match to search the name with specific boosts per
name type.
However my search score seems to only use the highest scoring sub-fields
score.
Want to get them summed....

Is there any way I can get them summed for my final score? Something akin
to: score_mode=sum ...

Here's full context of index and search attempts:
https://gist.github.com/jurgynet/6720252

AJ

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


(Alexander Ott) #2

Hallo,

i have the same problem if i send a query like this

"query" : {

    "query_string" : {
    "query" : "someText",
    "fields": ["field1", "field2", "field3"]

}

The explain will always show "description": "max of:"

"_explanation": {
"value": 20,
"description": "max of:",
"details": [
{
"value": 3,
"description": "weight(_field1:someText in 18415)
[PerFieldSimilarity], result of:",
"details": [
{
"value": 3,
"description": "fieldWeight in 18415, product
of:",
"details": [
{
"value": 3,
"description": "tf(freq=3.0), with freq
of:",
"details": [
{
"value": 3,
"description": "termFreq=3.0"
}
]
},
{
"value": 1,
"description": "idf(docFreq=36,
maxDocs=84821)"
},
{
"value": 1,
"description": "fieldNorm(doc=18415)"
}
]
}
]
},
{
"value": 20,
"description": "weight(field2:someText in 18415)
[PerFieldSimilarity], result of:",
"details": [
{
"value": 20,
"description": "fieldWeight in 18415, product
of:",
"details": [
{
"value": 2,
"description": "tf(freq=2.0), with freq
of:",
"details": [
{
"value": 2,
"description": "termFreq=2.0"
}
]
},
{
"value": 1,
"description": "idf(docFreq=10,
maxDocs=84821)"
},
{
"value": 10,
"description": "fieldNorm(doc=18415)"
}
]
}
]
},
{
"value": 4,
"description": "weight(field3:someText in 18415)
[PerFieldSimilarity], result of:",
"details": [
{
"value": 4,
"description": "fieldWeight in 18415, product
of:",
"details": [
{
"value": 1,
"description": "tf(freq=1.0), with freq
of:",
"details": [
{
"value": 1,
"description": "termFreq=1.0"
}
]
},
{
"value": 1,
"description": "idf(docFreq=12,
maxDocs=84821)"
},
{
"value": 4,
"description": "fieldNorm(doc=18415)"
}
]
}
]
}
]
}

Is it possible to use "sum of" for final score instead of "max of" ?

Greetings,
Alex

Am Donnerstag, 26. September 2013 22:48:27 UTC+2 schrieb Alan Jurgensen:

I have a multi_field where I stash the name several ways: asis, standard,
phonetic, nicknames

am trying to use multi-match to search the name with specific boosts per
name type.
However my search score seems to only use the highest scoring sub-fields
score.
Want to get them summed....

Is there any way I can get them summed for my final score? Something akin
to: score_mode=sum ...

Here's full context of index and search attempts:
https://gist.github.com/jurgynet/6720252

AJ

--
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/de64eb8f-33ea-4d5e-9ffa-34aa40d9a928%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Ivan Brusic) #3

Try setting use_dis_max to false in your query.

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_multi_field_2

Cheers,

Ivan

On Tue, Feb 11, 2014 at 1:15 AM, Alexander Ott
alexander.ott.85@gmail.comwrote:

Hallo,

i have the same problem if i send a query like this

"query" : {

    "query_string" : {
    "query" : "someText",
    "fields": ["field1", "field2", "field3"]

}

The explain will always show "description": "max of:"

"_explanation": {
"value": 20,
"description": "max of:",
"details": [
{
"value": 3,
"description": "weight(_field1:someText in 18415)
[PerFieldSimilarity], result of:",
"details": [
{
"value": 3,
"description": "fieldWeight in 18415, product
of:",
"details": [
{
"value": 3,
"description": "tf(freq=3.0), with freq
of:",
"details": [
{
"value": 3,
"description": "termFreq=3.0"
}
]
},
{
"value": 1,
"description": "idf(docFreq=36,
maxDocs=84821)"
},
{
"value": 1,
"description": "fieldNorm(doc=18415)"
}
]
}
]
},
{
"value": 20,
"description": "weight(field2:someText in 18415)
[PerFieldSimilarity], result of:",
"details": [
{
"value": 20,
"description": "fieldWeight in 18415, product
of:",
"details": [
{
"value": 2,
"description": "tf(freq=2.0), with freq
of:",
"details": [
{
"value": 2,
"description": "termFreq=2.0"
}
]
},
{
"value": 1,
"description": "idf(docFreq=10,
maxDocs=84821)"
},
{
"value": 10,
"description": "fieldNorm(doc=18415)"
}
]
}
]
},
{
"value": 4,
"description": "weight(field3:someText in 18415)
[PerFieldSimilarity], result of:",
"details": [
{
"value": 4,
"description": "fieldWeight in 18415, product
of:",
"details": [
{
"value": 1,
"description": "tf(freq=1.0), with freq
of:",
"details": [
{
"value": 1,
"description": "termFreq=1.0"
}
]
},
{
"value": 1,
"description": "idf(docFreq=12,
maxDocs=84821)"
},
{
"value": 4,
"description": "fieldNorm(doc=18415)"
}
]
}
]
}
]
}

Is it possible to use "sum of" for final score instead of "max of" ?

Greetings,
Alex

Am Donnerstag, 26. September 2013 22:48:27 UTC+2 schrieb Alan Jurgensen:

I have a multi_field where I stash the name several ways: asis,
standard, phonetic, nicknames

am trying to use multi-match to search the name with specific boosts per
name type.
However my search score seems to only use the highest scoring sub-fields
score.
Want to get them summed....

Is there any way I can get them summed for my final score? Something akin
to: score_mode=sum ...

Here's full context of index and search attempts:
https://gist.github.com/jurgynet/6720252

AJ

--
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/de64eb8f-33ea-4d5e-9ffa-34aa40d9a928%40googlegroups.com
.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCVxsNepqwwNsdbvUzPRjJg10fFHK3u-sit4XZ_X8AOgw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Binh Ly) #4

This will be addressed better in the future. For now, you can split/rewrite
your multi_match query into a bool query with multiple should clauses where
each clause is targeting each field in your multi_match (or query_string)
query. This still won't be quite a "sum", but at least it will "combine"
all the should clauses to produce the final score (i.e. the more matches
you have for each should clause, the higher the score will be).

In the future, the multi_match query will provide a type where you can
specify how the score is influenced based on field matches.

--
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/e47f9a0a-5f19-4fd6-9854-9c15cd67e177%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #5