You need to show us your mapping for the fields and also your query.
To my knowledge, the only way to use _boost values on specific keywords is
via the _all field. (I'm not 100% sure but I've tried to make this work for
a long time and the only success I've had is querying _all field.)
Elasticsearch Platform โ Find real-time answers at scale | Elastic. By
default, all properties are copied over to the _all field.
Next you must query on your _all field. The easiest way to do that is to
omit any field scoping from the query; this will default search the _all
field:
curl -XGET
'localhost:9200/index/_search?&search_type=dfs_query_then_fetch&pretty=true'
-d '{
"query": {
"query_string": {
"query": "red"
}
},
"sort": [{"_score": "desc"}],
"explain": true
}'
Notice I'm using dfs_query_then_fetch Elasticsearch Platform โ Find real-time answers at scale | Elastic.
This will give you more accurate scoring that you will need.
There are other issues you will need to consider like if "red" is indexed
anywhere else in the document, it means it will affect the term-frequencies
and your ranking will be affected.
To receive better help, please post a complete curl
recreation: Elasticsearch Platform โ Find real-time answers at scale | Elastic
On Monday, February 18, 2013 3:04:09 AM UTC-8, Noam Guy wrote:
Hi,
I know something like this was already answered but it's not what I need
I have two documents that look like this:
{
"image" : {
"lists" : [
{
"value" : "dior",
"my_boost" : "10"
},
{
"value" : "red",
"my_boost" : "2"
}
]
}
}
{
"image" : {
"lists" : [
{
"value" : "dior",
"my_boost" : "2"
},
{
"value" : "red",
"my_boost" : "10"
}
]
}
If I search for "red" I will get these two documents.
BUT
I would like the query to use the my_boost field to push the score higher
for the relevant search
This means that I want the second document to be first (because it has a
my_boost=10).
I was thinking that custom_score & script might help me - but I don't know
how to accomplish it.
Any help will be appreciated.
Noam.
--
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.