Two small questions:
-
The first document has a match on "java-8", but I would only like to match on "java". Same for the second document with docker.
How can I filter on the exact keywords? Should I change the mapping or is possible to fix this inside the search query? -
It looks like the score also weights the number of (non-matching) tags. It possible to exclude the non-matching tags in the score?
For me it is okay if ['php','java','x'] and ['php,','java','x','y','z'] have exactly the same score.
Request
GET localhost:9200/profile/_search
{
"query": {
"bool": {
"should": [
{
"term": {
"tags": "docker"
}
},
{
"term": {
"tags": "php"
}
},
{
"term": {
"tags": "java"
}
}
]
}
}
}
Response
[
{
"_score": 10.028147,
"_source": {
"name": "Harald",
"tags": [
"docker",
"java-8",
"website"
]
}
},
{
"_score": 9.958822,
"_source": {
"name": "Alex",
"tags": [
"java",
"spring",
"yaml",
"spring-boot",
"website",
"docker",
"docker-compose",
"docker-machine"
]
}
},
{
"_score": 9.919757,
"_source": {
"name": "Fleming",
"tags": [
"java",
"docker",
"dockerfile",
"website"
]
}
},
{
"_score": 9.911845,
"_source": {
"name": "Galley",
"tags": [
"php",
"html",
"docker",
"website"
]
}
}
]