Hi,
My question is related to boosting fields in Multi Match Query.
I have 3 fields: First name, Second name and description. A want the score
to be low, when it matches description field.
{
"function_score" : {
"query" : {
"bool" : {
"must" : [ {
"multi_match" : {
"query" : "te",
"fields" : [ "description", "name^10", "second_name^20" ],
"type" : "phrase_prefix",
"prefix_length" : 2,
}
}, {
"multi_match" : {
"query" : "test",
"fields" : [ "description", "name^10", "second_name^10" ],
"type" : "cross_fields",
"operator" : "AND"
}
} ]
}
},
}
}
But I mentioned that score doesn't change at all when I change boosting
variables(10 or 20). Is there is a way to create smart function, that
gives low score to objects that matches description field? Thank you in
advance.
Are you looking for something like this? It certainly orders correctly in
the results.
PUT multitest
POST /multitest/books/1
{
"title" : "The Fox",
"Description": "Mixing things around",
"Category" : "books"
}
POST /multitest/books/2
{
"title" : "A different title",
"Description": "all about a fox",
"Category" : "books"
}
POST /multitest/books/3
{
"title" : "a different title",
"Description": "not about animals",
"Category" : "Fox"
}
Hi,
My question is related to boosting fields in Multi Match Query.
I have 3 fields: First name, Second name and description. A want the score
to be low, when it matches description field.
{
"function_score" : {
"query" : {
"bool" : {
"must" : [ {
"multi_match" : {
"query" : "te",
"fields" : [ "description", "name^10", "second_name^20" ],
"type" : "phrase_prefix",
"prefix_length" : 2,
}
}, {
"multi_match" : {
"query" : "test",
"fields" : [ "description", "name^10", "second_name^10" ],
"type" : "cross_fields",
"operator" : "AND"
}
} ]
}
},
}
}
But I mentioned that score doesn't change at all when I change boosting
variables(10 or 20). Is there is a way to create smart function, that
gives low score to objects that matches description field? Thank you in
advance.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.