I have three food type indices \"Italian\", \"Spanish\", \"American\". When the user searches \"Cheese\", documents from \"Italian\" appear to come up at the top. Is it poss
For query-time boosting, queries (ex. query string) generally have a boost
attribute you can set. Alternatively, you can wrap queries in a custom boost factor. I would probably prefer the former, usually.
If querying several indices at once, it is possible to specify indices boost at the top level of object passed to Search API:
curl -XGET localhost:9200/italian,spanish,american/_search -d '
{
"query":{"term":{"food_type":"cheese"}},
"indices_boost" : {
"ilalian" : 1.4,
"spanish" : 1.3,
"american" : 1.1
}
}'
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-index-boost.html#search-request-index-boost
Use a script_score as part of the function score query:
function_score: {
script_score: {
script: "doc['_type'].value == '<your _type>' ? _score * <boost_factor> : _score"
}
}
Add a term query with a boost for either the _type field or the _index (or both).