elasticsearch/docs/reference/mapping
Benjamin Trent 8555b350cc
[8.x] Add new experimental rank_vectors mapping for late-interaction second order ranking (#118804) (#119601)
* Add new experimental rank_vectors mapping for late-interaction second order ranking (#118804)

Late-interaction models are powerful rerankers. While their size and
overall cost doesn't lend itself for HNSW indexing, utilizing them as
second order "brute-force" reranking can provide excellent boosts in
relevance. At generally lower inference times than large cross-encoders.


This commit exposes a new experimental `rank_vectors` field that allows
for maxSim operations. This unlocks the initial, and most common use of
late-interaction dense-models. 

For example, this is how you would use it via the API:

```
PUT index
{
  "mappings": {
    "properties": {
      "late_interaction_vectors": {
        "type": "rank_vectors"
      }
    }
  }
}
```

Then to index:

```
POST index/_doc
{
  "late_interaction_vectors": [[0.1, ...],...]
}
```

For querying, scoring can be exposed with scripting:

```
POST index/_search
{
  "query": {
    "script_score": {
      "query": {
        "match_all": {}
      },
      "script": {
        "source": "maxSimDotProduct(params.query_vector, 'my_vector')",
        "params": {
          "query_vector": [[0.42, ...], ...]
        }
      }
    }
  }
}
```

Of course, the initial ranking should be done before re-scoring or
combining via the `rescore` parameter, or simply passing whatever first
phase retrieval you want as the inner query in `script_score`.

* Update docs/changelog/119601.yaml
2025-01-07 05:19:38 +11:00
..
dynamic Add unmatch_mapping_type, and support array of types (#103171) 2024-02-09 10:42:26 -05:00
fields Update and edit logsdb docs for logsdb / synthetic source GA (#118303) (#118505) 2024-12-11 21:39:35 +01:00
params [DOCS] _index_prefix for highligh matched_fields (#118569) (#118580) 2024-12-13 03:27:56 +11:00
types [8.x] Add new experimental rank_vectors mapping for late-interaction second order ranking (#118804) (#119601) 2025-01-07 05:19:38 +11:00
dynamic-mapping.asciidoc [DOCS] Clean up index template xrefs (#67264) 2021-01-11 12:38:09 -05:00
explicit-mapping.asciidoc [DOCS] Refactor book-scoped variables in docs/reference/index.asciidoc (#107413) 2024-04-17 14:37:07 +02:00
fields.asciidoc Support fetching _tier field value (#71379) 2021-04-08 11:41:52 -07:00
mapping-settings-limit.asciidoc [DOCS] Refactor book-scoped variables in docs/reference/index.asciidoc (#107413) 2024-04-17 14:37:07 +02:00
params.asciidoc [DOCS] Remove redirect pages (#88738) 2023-05-24 12:32:46 +01:00
removal_of_types.asciidoc [DOCS] Fix double spaces (#71082) 2021-03-31 09:57:47 -04:00
runtime.asciidoc [DOCS] Lookup runtime fields are now GA (#114221) (#114229) 2024-10-08 00:20:27 +11:00
types.asciidoc [8.x] Add new experimental rank_vectors mapping for late-interaction second order ranking (#118804) (#119601) 2025-01-07 05:19:38 +11:00