PUT dvt_test_long/_doc/1
{
"items" : [1]
}
PUT dvt_test_long/_doc/2
{
"items" : [1, 2]
}
PUT dvt_test_long/_doc/3
{
"items" : [1, 2, 3]
}
PUT dvt_test_long/_doc/4
{
"items" : [1, 2, 3, 4]
}
Query:
GET dvt_test_long/_search
{
"query": {
"bool": {
"should": [
{
"terms": {
"items": [
"3",
"4"
]
}
}
]
}
}
}
Response:
{
"took" : 917,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 2,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "dvt_test_long",
"_type" : "_doc",
"_id" : "3",
"_score" : 1.0,
"_source" : {
"items" : [
1,
2,
3
]
}
},
{
"_index" : "dvt_test_long",
"_type" : "_doc",
"_id" : "4",
"_score" : 1.0,
"_source" : {
"items" : [
1,
2,
3,
4
]
}
}
]
}
}
As you can see, [1, 2, 3]
has same score as [1, 2, 3, 4]
where there were two matches [3, 4]
.
Is it possible to score the documents more based on no. of values matched ?
I want [1, 2, 3, 4]
to score higher.