elasticsearch/docs/reference/mapping
Mayya Sharipova 3260fd1fc8
Distance measures for dense and sparse vectors (#37947)
* Distance measures for dense and sparse vectors

Introduce painless functions of
cosineSimilarity and dotProduct distance
measures for dense and sparse vector fields.

```js
{
  "query": {
    "script_score": {
      "query": {
        "match_all": {}
      },
      "script": {
        "source": "cosineSimilarity(params.queryVector, doc['my_dense_vector'].value)",
        "params": {
          "queryVector": [4, 3.4, -1.2]
        }
      }
    }
  }
}
```

```js
{
  "query": {
    "script_score": {
      "query": {
        "match_all": {}
      },
      "script": {
        "source": "cosineSimilaritySparse(params.queryVector, doc['my_sparse_vector'].value)",
        "params": {
          "queryVector": {"2": -0.5, "10" : 111.3, "50": -13.0, "113": 14.8, "4545": -156.0}
        }
      }
    }
  }
}
```

Closes #31615
2019-02-20 07:01:17 -05:00
..
dynamic Remove remaining occurances of "include_type_name=true" in docs (#37646) 2019-01-22 15:13:52 +01:00
fields Remove remaining occurances of "include_type_name=true" in docs (#37646) 2019-01-22 15:13:52 +01:00
params Remove joda time mentions in documentation (#38720) 2019-02-14 10:18:48 +01:00
types Distance measures for dense and sparse vectors (#37947) 2019-02-20 07:01:17 -05:00
dynamic-mapping.asciidoc Reject updates to the _default_ mapping. (#29165) 2018-03-21 10:44:11 +01:00
fields.asciidoc Fix docs of the _ignored meta field. 2018-05-02 11:43:50 +02:00
params.asciidoc Improve docs for index_prefixes option (#35778) 2018-11-22 09:20:46 +00:00
removal_of_types.asciidoc Update the removal of types docs with the new 6.7 behavior. (#38869) 2019-02-13 14:43:35 -08:00
types.asciidoc Add nanosecond field mapper (#37755) 2019-02-04 11:31:16 +01:00