jillesvangurp / kt-search

Multi platform kotlin client for Elasticsearch & Opensearch with easily extendable Kotlin DSLs for queries, mappings, bulk, and more.
MIT License
107 stars 22 forks source link

[FEAT] - Add support for `knn_vector` mapping type - required for opensearch #146

Open chirag4semandex opened 3 months ago

chirag4semandex commented 3 months ago

Describe the enhancement

Currently, you have support for dense_vector type for supporting the KNN search. This works fine with elastic search but for OpenSearch, it uses knn_vector type.

I cannot find a way to use OpenSearch knn_vector type using this. The main reason is that in Opensearch, it's a plugin, and since it's a plugin, it requires special settings, something like the below, and currently your IndexSettings class has no such support.

"settings": {
    "index": {
      "knn": true
    }
  }

Why is this needed?

This is needed to make use of KNN search plugin using OpenSearch.

How do you think it should be done?

The easiest way would be to add a field in the IndexSettings class for KNN plugin-related information.

Another option for supporting other such plugins related settings is to make the IndexSettings class open so that people can extend it and provide whatever settings are needed.

Will you be able to help with a pull request? Sure

Optional, but do let me know if you plan to do work. Yes

jillesvangurp commented 2 months ago

Sounds good. I've been meaning to look at opensearch support for this in any case. Just super busy with other stuff lately.