opensearch-project / k-NN

🆕 Find the k-nearest neighbors (k-NN) for your vector data
https://opensearch.org/docs/latest/search-plugins/knn/index/
Apache License 2.0
152 stars 113 forks source link

Adds rescore parameter to KNNQuery #1969

Closed jmazanec15 closed 1 month ago

jmazanec15 commented 1 month ago

Description

Adds rescore parameter to knn query. With this commit, the rescore is a no-op. The functionality and validation will be added in a later commit.

The valid options look like:

"query": {
  "knn": {
    "target_field": {
      "vector": [0, 0],
      "k": 100,
      "rescore": true
    }
  }
}

"query": {
  "knn": {
    "target_field": {
      "vector": [0, 0],
      "k": 100,
      "rescore": {}
    }
  }
}

  "query": {
    "knn": {
      "target_field": {
        "vector": [0, 0],
        "k": 100,
        "rescore": {
            "oversample_factor": 1.2
        }
      }
    }
  }

Will update changelog once feature is completed

Related Issues

Related to #1779

Check List

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.