I am trying to use the script scoring function with a KNN vector field from Java/Spring. Below is the code that I am trying with, but its not returning text related to the vector I am passing. Could you please let me know if there is anything wrong with the way I am forming the query below?
Map params = new HashMap();
params.put("field", "nested.textVector");
params.put("query_value", queryVector);
params.put("space_type", "cosinesimil");
Script script = new Script(ScriptType.INLINE, "knn", "knn_score", params);
ScriptScoreQueryBuilder scriptScoreQueryBuilder = QueryBuilders.scriptScoreQuery(boolQueryBuilder, script);
I could not find any samples/documents for KNN scoring using Java API. Also could anyone please point me to any samples specific to KNN Java API? - Thanks
Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
opensearch: 2.7.0
opensearch-rest-high-level-client:2.7.0’
spring-data-opensearch-starter:1.1.0’
spring-data-opensearch:1.1.0’
opensearch-knn:2.9.0.0’
‘opensearch-java’, version: ‘2.6.0’