OpenSearch/docs/reference/migration
Julie Tibshirani 89c65752dc
Update the signature of vector script functions. (#48653)
Previously the functions accepted a doc values reference, whereas they now
accept the name of the vector field. Here's an example of how a vector function
was called before and after the change.

```
Before: cosineSimilarity(params.query_vector, doc['field'])
After:  cosineSimilarity(params.query_vector, 'field')
```

This seems more intuitive, since we don't allow direct access to vector doc
values and the the meaning of `doc['field']` is unclear.

The PR makes the following changes (broken into distinct commits):
* Add new function signatures of the form `function(params.query_vector,
'field')` and deprecates the old ones. Because Painless doesn't allow two
methods with the same name and number of arguments, we allow a generic `Object`
to be passed in to the function and decide on the behavior through an
`instanceof` check.
* Refactor the class bindings so that the document field is passed to the
constructor instead of the instance method. This allows us to avoid retrieving
the vector doc values on every function invocation, which gives a tiny speed-up
in benchmarks.

Note that this PR adds new signatures for the sparse vector functions too, even
though sparse vectors are deprecated. It seemed simplest to understand (for both
us and users) to keep everything symmetric between dense and sparse vectors.
2019-10-29 15:46:05 -07:00
..
apis [DOCS] Change // CONSOLE comments to [source,console] (#46441) (#46451) 2019-09-06 11:31:13 -04:00
migrate_7_0 [DOCS] Replace "// CONSOLE" comments with [source,console] (#46679) 2019-09-13 11:44:54 -04:00
index.asciidoc Add sparse vector deprecation to 7.6 migration docs. (#48435) 2019-10-28 11:57:20 -07:00
migrate_7_0.asciidoc Add missing "long form" 7.0 breaking changes (#41049) 2019-04-10 09:44:45 -04:00
migrate_7_1.asciidoc 7.1.0 release notes forward port (#42252) 2019-05-20 14:39:17 -04:00
migrate_7_2.asciidoc add 7.2.0 release notes 2019-06-26 08:50:11 -05:00
migrate_7_3.asciidoc [DOCS] Fixes missing discrete attribute 2019-08-01 09:11:14 -07:00
migrate_7_4.asciidoc Add realm uniqueness enforcement in 7.4 migration docs (#47487) 2019-10-03 11:03:29 +03:00
migrate_7_5.asciidoc Add support for aliases in queries on _index. (#46944) 2019-09-23 13:21:37 -07:00
migrate_7_6.asciidoc Update the signature of vector script functions. (#48653) 2019-10-29 15:46:05 -07:00
migration.asciidoc Remove Migration Upgrade and Assistance APIs (#40075) 2019-03-18 13:46:56 -06:00