logo
pub struct Rescore { /* private fields */ }
Expand description

Rescoring can help to improve precision by reordering just the top (eg 100 - 500) documents returned by the query and post_filter phases, using a secondary (usually more costly) algorithm, instead of applying the costly algorithm to all documents in the index.

A rescore request is executed on each shard before it returns its results to be sorted by the node handling the overall search request.

Currently the rescore API has only one implementation: the query rescorer, which uses a query to tweak the scoring. In the future, alternative rescorers may be made available, for example, a pair-wise rescorer.

To create a rescore query with simple term query:

Rescore::new(Query::term("title", "test"));

To create a rescore query with simple term query and optional fields:

Rescore::new(Query::term("title", "test"))
    .rescore_query_weight(0.2)
    .window_size(100);

https://www.elastic.co/guide/en/elasticsearch/reference/current/filter-search-results.html#rescore

Implementations

Creates a new instance of Rescore

  • query - Second query which will be execute on top-k results returned by original query.

The number of docs which will be examined on each shard can be controlled by the window_size parameter, which defaults to 10.

The relative importance of the rescore query can be controlled with the rescore_query_weight respectively. Both default to 1.

The relative importance of the original query can be controlled with the query_weight respectively. Both default to 1.

The way the scores are combined can be controlled with the

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.