Hello, I am trying to find a way to make following:
DELETE /sample
POST /sample/post/1
{
"title": "php",
"tags": ["php"],
"content": "php is a scripting language"
}
POST /sample/post/2
{
"title": "wordpress",
"tags": ["wordpress", "php"],
"content": "wordpress is a blog cms"
}
POST /sample/post/3
{
"title": "python",
"tags": ["python"],
"content": "python is a scripting language like php"
}
POST /sample/post/_search
{
"query": {
"filtered": {
"query": {
"bool": {
"should": [
{
"match": {
"title": "php"
}
},
{
"match": {
"tags": "php"
}
}
]
}
},
"filter": {}
}
}
}
We are searching documents by title
and tags
, but want to score those documents that have matches inside content
higher, without including them in search results
What I mean is that if we will add one more match for content
inside bool query we will get 3 docs instead of 2, and the 3rd one will be about python which is not desirable. If we will add minimum_should_match: 2
we wont receive wordpress document which is also undesirable.
May be someone will be able to help achieve desired behaviour