OpenSearch/docs/reference/search/request/index-boost.asciidoc

37 lines
1.1 KiB
Plaintext

[discrete]
[[index-boost]]
=== Index boost
When searching multiple indices, you can use the `indices_boost` parameter to
boost results from one or more specified indices. This is useful when hits
coming from one index matter more than hits coming from another index.
[source,console]
--------------------------------------------------
GET /_search
{
"indices_boost": [
{ "my-index-000001": 1.4 },
{ "my-index-000002": 1.3 }
]
}
--------------------------------------------------
// TEST[s/^/PUT my-index-000001\nPUT my-index-000002\n/]
You can also specify it as an array to control the order of boosts.
[source,console]
--------------------------------------------------
GET /_search
{
"indices_boost": [
{ "my-alias": 1.4 },
{ "my-index*": 1.3 }
]
}
--------------------------------------------------
// TEST[s/^/PUT my-index-000001\nPUT my-index-000001\/_alias\/my-alias\n/]
This is important when you use aliases or wildcard expression.
If multiple matches are found, the first match will be used.
For example, if an index is included in both `alias1` and `index*`, boost value of `1.4` is applied.