Boosting per field during runtime is not working...please help


(nirmala ranganathan) #1

Here my query:

curl -XGET 'localhost:9200/mongoentityindex/_search?pretty=true' -d '
{
"fields": ["entityData.contact.name",
"entityData.contact.streetAddress", "entityData.contact.addressLocality",
"entityData.aliasList"],
"query": {
"query_string": {
"fields" :
["entityData.contact.name^20","entityData.contact.streetAddress^10","entityData.contact.addressLocality^8","entityData.aliasList^1"],
"query": "North Star",
"default_operator" : "and",
"analyzer" : "standard",
"analyze_wildcard": true,
"allow_leading_wildcard" : true,
"lowercase_expanded_terms" : true,
"enable_position_increments" : true,
"auto_generate_phrase_queries": true,
"fuzzy_prefix_length" : 0,
"fuzzy_min_sim" : 0.5,
"phrase_slop" : 0,
"boost" : 5.0
}
},
"highlight" : {
"pre_tags" : [""],
"post_tags" : [""],
"fields" : {"_all" : {}}
},
"size":10
}'

Without the fields marked red above in the "query_string", it returns 10
results as per the query.
I would like to query by boosting the fields during run time otherwise the
results returned is not in the right order.
Other alternative is to boost during mapping time but I don't want to do
that because if there is a need to change the boosting in future I need to
redo the mapping.

Please help.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Luca Cavanna) #2

Hi,
not sure I got what the problem is.

If you specify multiple fields on your query you potentially get back more
results, since you are searching against multiple fields. You can then
assign weights to those fields in order to tune their importance, as you
did. Those weights need some fine-tuning though, as the score doesn't only
depend on them.

On Saturday, November 23, 2013 4:07:07 AM UTC+1, nirmala ranganathan wrote:

Here my query:

curl -XGET 'localhost:9200/mongoentityindex/_search?pretty=true' -d '
{
"fields": ["entityData.contact.namehttp://www.google.com/url?q=http%3A%2F%2FentityData.contact.name&sa=D&sntz=1&usg=AFQjCNHz4krw84PJoNu_k-R3foIgNRzvrA",
"entityData.contact.streetAddress", "entityData.contact.addressLocality",
"entityData.aliasList"],
"query": {
"query_string": {
"fields" : ["entityData.contact.namehttp://www.google.com/url?q=http%3A%2F%2FentityData.contact.name&sa=D&sntz=1&usg=AFQjCNHz4krw84PJoNu_k-R3foIgNRzvrA
^20","entityData.contact.streetAddress^10","entityData.contact.addressLocality^8","entityData.aliasList^1"],
"query": "North Star",
"default_operator" : "and",
"analyzer" : "standard",
"analyze_wildcard": true,
"allow_leading_wildcard" : true,
"lowercase_expanded_terms" : true,
"enable_position_increments" : true,
"auto_generate_phrase_queries": true,
"fuzzy_prefix_length" : 0,
"fuzzy_min_sim" : 0.5,
"phrase_slop" : 0,
"boost" : 5.0
}
},
"highlight" : {
"pre_tags" : [""],
"post_tags" : [""],
"fields" : {"_all" : {}}
},
"size":10
}'

Without the fields marked red above in the "query_string", it returns 10
results as per the query.
I would like to query by boosting the fields during run time otherwise the
results returned is not in the right order.
Other alternative is to boost during mapping time but I don't want to do
that because if there is a need to change the boosting in future I need to
redo the mapping.

Please help.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3