I have the following phrase:
It's never happened to me – Messi Player of Barcelona to Cristiano Ronaldo star of Real
Madrid thanks Juve fans for ovation.
And a simple elasticsearch document called Player
:
"firstName": {
"localizedValues": {
"de": "",
"en": "Cristiano"
}
},
"lastName": {
"localizedValues": {
"de": "",
"en": "Ronaldo"
}
}
"teamAssociations": [
{
"active": true,
"teamName": {
"localizedValues": {
"de": "",
"en": "Real Madrid"
}
}
]
What I'm trying to do, is a simple mapping approach,
Try to find a Player that plays for a team, in this case I would like to get Cristiano Ronaldo and Messi, and if a team in that phrase is found, then have that to boost the score for more relevance.
What I have tried so far:
{
"query": {
"bool": {
"must": {
"multi_match" : {
"query": " It's never happened to me – Messi to Cristiano Ronaldo star of Real Madrid thanks Juve fans for ovation ",
"fields": [ "firstName.localizedValues.*", "lastName.localizedValues.*", "teamAssociations.teamName.*^3" ],
"type": "cross_fields",
"analyzer": "english"
}
}
}
}
}
But that gets also other players that plays for Read Madrid, which I don't want.
Also in that title I might not have the team name, just players, so the team should be optional but important if found.
How can I approach this problem ?
Thanks in advance for the help.