Multi Match Query boosting fields


(Kirill) #1

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.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/29b352f7-e38a-442b-8653-35e66ced4423%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Allan Mitchell) #2

Hi

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"
}

GET /multitest/_search
{
"query": {
"multi_match": {
"query": "Fox",
"fields": [ "title^0.5", "Description^2", "Category^3" ]
}
}
}

Allan

On 4 May 2015 at 16:41, Kirill kzhdanovich@gmail.com wrote:

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.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/29b352f7-e38a-442b-8653-35e66ced4423%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/29b352f7-e38a-442b-8653-35e66ced4423%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
Please update your bookmarks! We moved to https://discuss.elastic.co/

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAECdJzAM9sC%3DxY8Y1w4jB43geyJ1WnxCpX54Y9pAe1DAjXtLQw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3