Score boost not working


(Himanshu Kulkarni) #1

This is my mapping for my website search index.
{
"website4md": {
"mappings": {
"page": {
"properties": {
"content": {
"type": "text",
"fields": {
"reverse": {
"type": "text",
"analyzer": "reverse"
},
"search": {
"type": "text",
"analyzer": "ngram"
},
"trigram": {
"type": "text",
"analyzer": "trigram"
}
}
},
"description": {
"type": "text"
},
"headers": {
"type": "text",
"fields": {
"reverse": {
"type": "text",
"analyzer": "reverse"
},
"search": {
"type": "text",
"analyzer": "ngram"
},
"trigram": {
"type": "text",
"analyzer": "trigram"
}
}
},
"linktext": {
"type": "text",
"fields": {
"reverse": {
"type": "text",
"analyzer": "reverse"
},
"search": {
"type": "text",
"analyzer": "ngram"
},
"trigram": {
"type": "text",
"analyzer": "trigram"
}
}
},
"tags": {
"type": "text",
"analyzer": "standard",
"search_analyzer": "english"
},
"title": {
"type": "text",
"fields": {
"reverse": {
"type": "text",
"analyzer": "reverse"
},
"search": {
"type": "text",
"analyzer": "ngram"
},
"trigram": {
"type": "text",
"analyzer": "trigram"
}
}
},
"url": {
"type": "text"
}
}
}
}
}
}

I am trying to use this query to search through the index and I want to give importance to specific fields. (Like results where title matches should have a higher score.)

{
"query": {
"bool": {
"must": {
"multi_match": {
"query": "what is website",
"fields": ["title.search^20","headers.search^15","linktext^10","content.search^10","url"]
}
},
"should": {
"multi_match": {
"query": "what is website",
"fields": ["title^20", "headers^15","content^5"]
}
}
}
}
}

I want to have some special field in my data called "tags" where if the searched keywords match with the tags the document should always be at the top in the results.

So I'm doing something like this...
{
"query": {
"bool": {
"must": {
"multi_match": {
"query": "what is website",
"fields": ["tags^1000","title.search^20","headers.search^15","linktext^10","content.search^10","url"]
}
},
"should": {
"multi_match": {
"query": "what is website",
"fields": ["tags^1000","title^20", "headers^15","content^5"]
}
}
}
}
}

But it is not affecting the score, the results are just like they were earlier.
Can anyone please point out where I'm going wrong?


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.