Hi guys, I am struggling with a setup to be able to search using weighted
tags. The score comes out wrong and some objects (that should match) are
ignored completely.
My docs:
[
"title":"1", "tags" : ["a", "b", "c"],
"title":"2", "tags" : ["a", "b"],
"title":"3", "tags" : ["c", "b"],
"title":"4", "tags" : ["b"]
]
My query:
{
"query": {
"custom_filters_score": {
"query": {
"terms": {
"tags": ["a", "c"]
}
},
"filters": [
{"filter":{"term":{"tags":"a"}}, "script":"1.0"},
{"filter":{"term":{"tags":"c"}}, "script":"1.5"}
],
"score_mode": "total"
}
}
}
Response:
{
"_shards": {
"failed": 0,
"successful": 5,
"total": 5
},
"hits": {
"hits": [
{
"_id": "3",
"_index": "test",
"_score": 0.23837921,
"_source": {
"tags": [
"c",
"b"
],
"title": "3"
},
"_type": "bit"
},
{
"_id": "1",
"_index": "test",
"_score": 0.042195037,
"_source": {
"tags": [
"a",
"b",
"c"
],
"title": "1"
},
"_type": "bit"
}
],
"max_score": 0.23837921,
"total": 2
},
"timed_out": false,
"took": 3
}
However, I expected the following result:
- Document 1 (score: 2.5 because "a" and "c")
- Document 3 (score: 1.5 because "c")
- Document 2 (score: 1.0 because "a")
That is, the document #2 is missing completely, the order and the scores
are wrong.
Can you give me a hint of what I am doing wrong?
--
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.